<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def console(session, database=None, user=None, password=None, server=None):
 """An interactive Python API console for MyGeotab If IPython is installed, it will launch an interactive IPython console instead of the built-in Python console. The IPython console has numerous advantages over the stock Python console, including: colors, pretty printing, command auto-completion, and more. By default, all library objects are available as locals in the script, with 'myg' being the active API object. :param session: The current Session object. :param database: The database name to open a console to. :param user: The username used for MyGeotab servers. Usually an email address. :param password: The password associated with the username. Optional if `session_id` is provided. :param server: The server ie. my23.geotab.com. Optional as this usually gets resolved upon authentication. """

    local_vars = _populate_locals(database, password, server, session, user)
    version = 'MyGeotab Console {0} [Python {1}]'.format(mygeotab.__version__,
                                                         sys.version.replace('\n', ''))
    auth_line = ('Logged in as: %s' % session.credentials) if session.credentials else 'Not logged in'
    banner = '\n'.join([version, auth_line])
    try:
        from IPython import embed

        embed(banner1=banner, user_ns=local_vars)
    except ImportError:
        import code

        code.interact(banner, local=local_vars)