<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def login():
 """ Enables the user to login to the remote GMQL service. If both username and password are None, the user will be connected as guest. """

    from .RemoteConnection.RemoteManager import RemoteManager
    global __remote_manager, __session_manager

    logger = logging.getLogger()
    remote_address = get_remote_address()
    res = __session_manager.get_session(remote_address)
    if res is None:
        # there is no session for this address, let's login as guest
        warnings.warn("There is no active session for address {}. Logging as Guest user".format(remote_address))
        rm = RemoteManager(address=remote_address)
        rm.login()
        session_type = "guest"
    else:
        # there is a previous session for this address, let's do an auto login
        # using that access token
        logger.info("Logging using stored authentication token")
        rm = RemoteManager(address=remote_address, auth_token=res[1])
        # if the access token is not valid anymore (therefore we are in guest mode)
        # the auto_login function will perform a guest login from scratch
        session_type = rm.auto_login(how=res[2])
    # store the new session
    __remote_manager = rm
    access_time = int(time.time())
    auth_token = rm.auth_token
    __session_manager.add_session(remote_address, auth_token, access_time, session_type)