<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_global_dbapi_info(dbapi_module, conn):
 """ Fetches all needed information from the top-level DBAPI module, guessing at the module if it wasn't passed as a parameter. Returns a dictionary of all the needed variables. This is put in one place to make sure the error message is clear if the module "guess" is wrong. """

    module_given_msg = "The DBAPI2 module given ({0}) is missing the global\n"+\
    "variable '{1}'. Please make sure you are supplying a module that\n"+\
    "conforms to the DBAPI 2.0 standard (PEP 0249)."
    module_not_given_msg = "Hello! I gave my best effort to find the\n"+\
    "top-level module that the connection object you gave me came from.\n"+\
    "I found '{0}' which doesn't have the global variable '{1}'.\n"+\
    "To avoid this confusion, you can pass the module as a parameter using\n"+\
    "the 'dbapi_module' argument to either from_sql or to_sql."

    if dbapi_module is None:
        dbapi_module = _get_module_from_object(conn)
        module_given = False
    else:
        module_given = True

    module_name = dbapi_module.__name__ if hasattr(dbapi_module, '__name__') else None

    needed_vars = ['apilevel','paramstyle','Error','DATETIME','NUMBER','ROWID']
    ret_dict = {}
    ret_dict['module_name'] = module_name

    for i in needed_vars:
        tmp = None
        try:
            tmp = eval("dbapi_module."+i)
        except AttributeError as e:
            # Some DBs don't actually care about types, so they won't define
            # the types. These are the ACTUALLY needed variables though
            if i not in ['apilevel','paramstyle','Error']:
                pass
            elif module_given:
                raise AttributeError(module_given_msg.format(module_name, i))
            else:
                raise AttributeError(module_not_given_msg.format(module_name, i))
        ret_dict[i] = tmp

    try:
        if ret_dict['apilevel'][0:3] != "2.0":
            raise NotImplementedError("Unsupported API version " +\
              str(ret_dict['apilevel']) + ". Only DBAPI 2.0 is supported.")
    except TypeError as e:
        e.message = "Module's 'apilevel' value is invalid."
        raise e

    acceptable_paramstyles = ['qmark','numeric','named','format','pyformat']
    try:
        if ret_dict['paramstyle'] not in acceptable_paramstyles:
            raise TypeError("Module's 'paramstyle' value is invalid.")
    except TypeError as e:
        raise TypeError("Module's 'paramstyle' value is invalid.")

    return ret_dict