+
+OSM_TYPE = {'N': 'node', 'W': 'way', 'R': 'relation',
+ 'n': 'node', 'w': 'way', 'r': 'relation',
+ 'node': 'n', 'way': 'w', 'relation': 'r'}
+
+
+class OsmType:
+ """ Compares an OSM type, accepting both N/R/W and node/way/relation.
+ """
+
+ def __init__(self, value):
+ self.value = value
+
+ def __eq__(self, other):
+ return other == self.value or other == OSM_TYPE[self.value]
+
+ def __str__(self):
+ return f"{self.value} or {OSM_TYPE[self.value]}"
+
+
+class Field:
+ """ Generic comparator for fields, which looks at the type of the
+ value compared.