'Get the application service with the given appservice token.
Args:
token (str): The application service token.
Returns:
synapse.appservice.ApplicationService or None.'

def get_app_service_by_token(self, token):

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