'Retrieve an application service from their user ID.
All application services have associated with them a particular user ID.
There is no distinguishing feature on the user ID which indicates it
represents an application service. This function allows you to map from
a user ID to an application service.
Args:
user_id(str): The user ID to see if it is an application service.
Returns:
synapse.appservice.ApplicationService or None.'

def get_app_service_by_user_id(self, user_id):

    for service in self.services_cache:
        if (service.sender == user_id):
            return service
    return None
