<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def healthy_services(self, role=None):
        '''
        Look up healthy services in the registry.

        A service is considered healthy if its 'last_heartbeat' was less than
        'ttl' seconds ago

        Args:
            role (str, optional): role name

        Returns:
            If `role` is supplied, returns list of healthy services for the
            given role, otherwise returns list of all healthy services. May
            return an empty list.
        '''
        try:
            query = self.rr.table(self.table)
            if role:
                query = query.get_all(role, index='role')
            query = query.filter(
                lambda svc: r.now().sub(svc["last_heartbeat"]) < svc["ttl"]   #.default(20.0)
            ).order_by("load")
            result = query.run()
            return result
        except r.ReqlNonExistenceError:
            return []