'Creates a new access token for the user with the given user ID.
The user is assumed to have been authenticated by some other
machanism (e.g. CAS), and the user_id converted to the canonical case.
The device will be recorded in the table if it is not there already.
Args:
user_id (str): canonical User ID
device_id (str|None): the device ID to associate with the tokens.
None to leave the tokens unassociated with a device (deprecated:
we should always have a device ID)
initial_display_name (str): display name to associate with the
device if it needs re-registering
Returns:
The access token for the user\'s session.
Raises:
StoreError if there was a problem storing the token.
LoginError if there was an authentication problem.'

@defer.inlineCallbacks
def get_access_token_for_user_id(self, user_id, device_id=None, initial_display_name=None):

    logger.info('Logging    in    user    %s    on    device    %s', user_id, device_id)
    access_token = (yield self.issue_access_token(user_id, device_id))
    if (device_id is not None):
        (yield self.device_handler.check_device_registered(user_id, device_id, initial_display_name))
    defer.returnValue(access_token)
