<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(username, password, **kwargs):
 """ Login a user, returning a dict containing their user_id and session_id This does the DB login to check the credentials, and then creates a session so that requests from apps do not need to perform a login args: username (string):
 The user's username password(string):
 The user's password (unencrypted) returns: A dict containing the user_id and session_id raises: HydraError if the login fails """


    user_id = util.hdb.login_user(username, password)

    hydra_session = session.Session({}, #This is normally a request object, but in this case is empty
            validate_key=config.get('COOKIES', 'VALIDATE_KEY', 'YxaDbzUUSo08b+'),
            type='file',
            cookie_expires=True,
            data_dir=config.get('COOKIES', 'DATA_DIR', '/tmp'),
            file_dir=config.get('COOKIES', 'FILE_DIR', '/tmp/auth'))

    hydra_session['user_id'] = user_id
    hydra_session['username'] = username
    hydra_session.save()

    return (user_id, hydra_session.id)