def __repr__(self):
        """
        Returns a string representation of this beacon information object.

        The beacons are sorted by their identifier.

        @return: The string representation.
        @rtype: C{str}
        """
        sortedBeacons = partial(sorted, key=attrgetter("identifier"))

        usedBeacons = sortedBeacons(self.usedBeacons)
        unusedBeacons = sortedBeacons(self.seenBeacons - self.usedBeacons)

        template = ("<BeaconInformation ("
                    "used beacons ({numUsed}): {usedBeacons}, "
                    "unused beacons: {unusedBeacons})>")

        formatted = template.format(numUsed=len(self.usedBeacons),
                                    usedBeacons=usedBeacons,
                                    unusedBeacons=unusedBeacons)

        return formatted

        Returns a string representation of this beacon information object.

        The beacons are sorted by their identifier.

        @return: The string representation.
        @rtype: C{str}
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/positioning/base.py