<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def expect_retval(connection, command, expected_status=0, timeout=10):
        '''
        Run command and expect specified return valud

        @param connection: connection to the host
        @type connection: L{Connection}

        @param command: command to execute
        @type command: str

        @param expected_status: expected return value
        @type expected_status: int

        @param timeout: timeout for performing expect operation
        @type  timeout: int

        @return: return value
        @rtype: int

        @raises ExpectFailed
        '''
        retval = connection.recv_exit_status(command, timeout)
        if retval is None:
            raise ExpectFailed("Got timeout (%i seconds) while executing '%s'"
                               % (timeout, command))
        elif retval != expected_status:
            raise ExpectFailed("Got %s exit status (%s expected)\ncmd: %s\nstdout: %s\nstderr: %s"
                               % (retval, expected_status, connection.last_command,
                                  connection.last_stdout, connection.last_stderr))
        if connection.output_shell:
            sys.stdout.write("Run '%s', got %i return value\n"
                             % (command, retval))
        return retval