# Path: core/ezdxf/tools/binarydata.py
# def compress_binary_data(tags):
#     dxftype = tags.dxftype()
#     for subclass in tags.subclasses[1:]:
#         if not subclass:  # empty subclass AcDbVertex
#             continue  # todo: why is subclass AcDbVertex empty, should contain DXFTag(100, 'AcDbVertex')
#             # but it works, output DXF contains all necessary subclasses
#         name = subclass[0].value
#         if name == 'AcDbEntity' and dxftype in ENTITIES_WITH_PROXY_GRAPHIC:
#             # 310: proxy entity graphics data
#             _compress_binary_tags(subclass)
#         if name in SUBCLASSES_WITH_BINARY_DATA:
#             # 310: binary object data
#             _compress_binary_tags(subclass)
# 
# Path: core/ezdxf/tools/handle.py
# class HandleGenerator(object):
#     def __init__(self, start_value='1'):
#         self._handle = int(start_value, 16)
#     reset = __init__
# 
#     def __str__(self):
#         return "%X" % self._handle
# 
#     def next(self):
#         next_handle = self.__str__()
#         self._handle += 1
#         return next_handle
#     __next__ = next


from .tools.binarydata import compress_binary_data
from .tools.handle import HandleGenerator
        """ Iterate over all handles. """
        return iter(self._database.keys())

    def keys(self):
        """ Iterate over all handles. """
        return self._database.keys()

    def values(self):
        """ Iterate over all entities. """
        return self._database.values()

    def items(self):
        """ Iterate over all (handle, entities) pairs. """
        return self._database.items()

    def add_tags(self, tags):
        try:
            handle = tags.get_handle()
        except ValueError:
            handle = self.handles.next()
        self.__setitem__(handle, tags)
        return handle

    def delete_entity(self, entity):
        entity.destroy()
        self.delete_handle(entity.dxf.handle)

    def delete_handle(self, handle):
        del self._database[handle]


# Path: core/ezdxf/tools/binarydata.py
# def compress_binary_data(tags):
#     dxftype = tags.dxftype()
#     for subclass in tags.subclasses[1:]:
#         if not subclass:  # empty subclass AcDbVertex
#             continue  # todo: why is subclass AcDbVertex empty, should contain DXFTag(100, 'AcDbVertex')
#             # but it works, output DXF contains all necessary subclasses
#         name = subclass[0].value
#         if name == 'AcDbEntity' and dxftype in ENTITIES_WITH_PROXY_GRAPHIC:
#             # 310: proxy entity graphics data
#             _compress_binary_tags(subclass)
#         if name in SUBCLASSES_WITH_BINARY_DATA:
#             # 310: binary object data
#             _compress_binary_tags(subclass)
# 
# Path: core/ezdxf/tools/handle.py
# class HandleGenerator(object):
#     def __init__(self, start_value='1'):
#         self._handle = int(start_value, 16)
#     reset = __init__
# 
#     def __str__(self):
#         return "%X" % self._handle
# 
#     def next(self):
#         next_handle = self.__str__()
#         self._handle += 1
#         return next_handle
#     __next__ = next


# Path: core/ezdxf/database.py
from .tools.binarydata import compress_binary_data
from .tools.handle import HandleGenerator

        """ Iterate over all handles. """
        return iter(self._database.keys())

    def keys(self):
        """ Iterate over all handles. """
        return self._database.keys()

    def values(self):
        """ Iterate over all entities. """
        return self._database.values()

    def items(self):
        """ Iterate over all (handle, entities) pairs. """
        return self._database.items()

    def add_tags(self, tags):
        try:
            handle = tags.get_handle()
        except ValueError:
            handle = self.handles.next()
        self.__setitem__(handle, tags)
        return handle

    def delete_entity(self, entity):
        entity.destroy()
        self.delete_handle(entity.dxf.handle)

    def delete_handle(self, handle):
        del self._database[handle]


    def compress_binary_data(self):