@classmethod
    def active(cls, group=None, delta=datetime.timedelta(minutes=1)):
        """Get the currently active encoders.

        Args:
            group: Group to get active servers for. Defaults to all groups.
            delta: A time delta describing how long ago the encoder must have
                   registered to be considered active. Defaults to 1 minute
                   ago.

        Returns:
            A real list of Endpoint objects.
        """
        # Get all the active streaming severs for this channel
        lastseen_after = datetime.datetime.now() - delta
        q = cls.objects.filter(lastseen__gte=lastseen_after).order_by(
            'group', 'ip', '-lastseen'
            )
        if group:
            q = q.filter(group__exact=group)

        # distinct_support = True
        try:
            qd = q.distinct('group', 'ip')
            return list(qd)
        except __HOLE__:
            distinct_endpoints = {}
            for endpoint in q:
                key = (endpoint.group, endpoint.ip)

                if key not in distinct_endpoints:
                    distinct_endpoints[key] = endpoint

            return list(distinct_endpoints.values())
dataset/ETHPy150Open timvideos/streaming-system/website/tracker/models.py/Endpoint.active