# Path: OSMPythonTools/internal/singletonApi.py
# class SingletonApi():
#     __instance = None
#     def __init__(self, *args, **kwargs):
#         from OSMPythonTools.api import Api
#         if not SingletonApi.__instance:
#             SingletonApi.__instance = Api(*args, **kwargs)
#     def __getattr__(self, name):
#         return getattr(self.__instance, name)
# 
# Path: OSMPythonTools/internal/elementShallow.py
# class ElementShallow(Response):
#     def __init__(self, cacheMetadata):
#         super().__init__(cacheMetadata)
#     def type(self):
#         return None
#     def id(self):
#         return None
#     def typeId(self):
#         return self.type() + '/' + str(self.id()) if self.type() != None and self.id() != None else None
#     def typeIdShort(self):
#         return self.type()[0] + str(self.id()) if self.type() != None and self.id() != None else None
#     def areaId(self):
#         return self._areaId(self.type(), self.id())
#     def _areaId(self, type, id):
#         if type == 'way':
#             return id + 2400000000
#         elif type == 'relation':
#             return id + 3600000000
#         else:
#             return None


import copy
import dateutil.parser
import geojson
import re
import OSMPythonTools
from OSMPythonTools.internal.singletonApi import SingletonApi
from OSMPythonTools.internal.elementShallow import ElementShallow
            type = 'node'
        elif idToParse[0].lower() == 'w':
            type = 'way'
        elif idToParse[0].lower() == 'r':
            type = 'relation'
        else:
            Element._raiseException(None, 'Could not parse element type. Please make sure that your node, way, or relation ID is formatted properly: \'node/***\', \'node ***\', \'n***\', \'way/***\', \'way ***\', \'w***\', or \'relation/***\', \'relation ***\', or \'r***\'')
        idToParse = re.sub('[^0-9]', '', idToParse)
        if len(idToParse) > 0:
            id = int(idToParse)
        else:
            Element._raiseException(None, 'Could not parse element ID. Please make sure that your node, way, or relation ID is formatted properly: \'node/***\', \'node ***\', \'n***\', \'way/***\', \'way ***\', \'w***\', or \'relation/***\', \'relation ***\', or \'r***\'')
        return Element(json={'type': type, 'id': id}, shallow=True)

    def _raiseException(self, msg):
        OSMPythonTools._raiseException('Element', msg)

    def __getElement(self, prop):
        if self._shallow and prop not in ['type', 'id']:
            self._unshallow()
            self._shallow = False
        if self._json is not None:
            return self._json[prop] if prop in self._json else None
        return self._soup[prop] if self._isValid and prop in self._soup.attrs else None

    def _unshallow(self):
        raise(NotImplementedError('Subclass should implement _unshallow'))

    ### properties
    def type(self):

# Path: OSMPythonTools/internal/singletonApi.py
# class SingletonApi():
#     __instance = None
#     def __init__(self, *args, **kwargs):
#         from OSMPythonTools.api import Api
#         if not SingletonApi.__instance:
#             SingletonApi.__instance = Api(*args, **kwargs)
#     def __getattr__(self, name):
#         return getattr(self.__instance, name)
# 
# Path: OSMPythonTools/internal/elementShallow.py
# class ElementShallow(Response):
#     def __init__(self, cacheMetadata):
#         super().__init__(cacheMetadata)
#     def type(self):
#         return None
#     def id(self):
#         return None
#     def typeId(self):
#         return self.type() + '/' + str(self.id()) if self.type() != None and self.id() != None else None
#     def typeIdShort(self):
#         return self.type()[0] + str(self.id()) if self.type() != None and self.id() != None else None
#     def areaId(self):
#         return self._areaId(self.type(), self.id())
#     def _areaId(self, type, id):
#         if type == 'way':
#             return id + 2400000000
#         elif type == 'relation':
#             return id + 3600000000
#         else:
#             return None


# Path: OSMPythonTools/element.py
import copy
import dateutil.parser
import geojson
import re
import OSMPythonTools
from OSMPythonTools.internal.singletonApi import SingletonApi
from OSMPythonTools.internal.elementShallow import ElementShallow

            type = 'node'
        elif idToParse[0].lower() == 'w':
            type = 'way'
        elif idToParse[0].lower() == 'r':
            type = 'relation'
        else:
            Element._raiseException(None, 'Could not parse element type. Please make sure that your node, way, or relation ID is formatted properly: \'node/***\', \'node ***\', \'n***\', \'way/***\', \'way ***\', \'w***\', or \'relation/***\', \'relation ***\', or \'r***\'')
        idToParse = re.sub('[^0-9]', '', idToParse)
        if len(idToParse) > 0:
            id = int(idToParse)
        else:
            Element._raiseException(None, 'Could not parse element ID. Please make sure that your node, way, or relation ID is formatted properly: \'node/***\', \'node ***\', \'n***\', \'way/***\', \'way ***\', \'w***\', or \'relation/***\', \'relation ***\', or \'r***\'')
        return Element(json={'type': type, 'id': id}, shallow=True)

    def _raiseException(self, msg):
        OSMPythonTools._raiseException('Element', msg)

    def __getElement(self, prop):
        if self._shallow and prop not in ['type', 'id']:
            self._unshallow()
            self._shallow = False
        if self._json is not None:
            return self._json[prop] if prop in self._json else None
        return self._soup[prop] if self._isValid and prop in self._soup.attrs else None

    def _unshallow(self):
        raise(NotImplementedError('Subclass should implement _unshallow'))

    ### properties
    def type(self):

        if self._json is not None: