'Logs in to the Telnet server with the given user information.
This keyword reads from the connection until the ``login_prompt`` is
encountered and then types the given ``username``. Then it reads until
the ``password_prompt`` and types the given ``password``. In both cases
a newline is appended automatically and the connection specific
timeout used when waiting for outputs.
How logging status is verified depends on whether a prompt is set for
this connection or not:
1) If the prompt is set, this keyword reads the output until the prompt
is found using the normal timeout. If no prompt is found, login is
considered failed and also this keyword fails. Note that in this case
both ``login_timeout`` and ``login_incorrect`` arguments are ignored.
2) If the prompt is not set, this keywords sleeps until ``login_timeout``
and then reads all the output available on the connection. If the
output contains ``login_incorrect`` text, login is considered failed
and also this keyword fails. Both of these configuration parameters
were added in Robot Framework 2.7.6. In earlier versions they were
hard coded.
See `Configuration` section for more information about setting
newline, timeout, and prompt.'

def login(self, username, password, login_prompt='login:    ', password_prompt='Password:    ', login_timeout='1    second', login_incorrect='Login    incorrect'):

    output = self._submit_credentials(username, password, login_prompt, password_prompt)
    if self._prompt_is_set():
        (success, output2) = self._read_until_prompt()
    else:
        (success, output2) = self._verify_login_without_prompt(login_timeout, login_incorrect)
    output += output2
    self._log(output)
    if (not success):
        raise AssertionError('Login    incorrect')
    return output
