def file_info_from_modpath(modpath, path=None, context_file=None):
if context_file is not None:<EOL><INDENT>context = os.path.dirname(context_file)<EOL><DEDENT>else:<EOL><INDENT>context = context_file<EOL><DEDENT>if modpath[<NUM_LIT:0>] == "<STR_LIT>":<EOL><INDENT>try:<EOL><INDENT>return _spec_from_modpath(["<STR_LIT>"] + modpath[<NUM_LIT:1>:], path, context)<EOL><DEDENT>except ImportError:<EOL><INDENT>return _spec_from_modpath(modpath, path, context)<EOL><DEDENT><DEDENT>elif modpath == ["<STR_LIT>", "<STR_LIT:path>"]:<EOL><INDENT>return spec.ModuleSpec(<EOL>name="<STR_LIT>", location=os.path.__file__, module_type=imp.PY_SOURCE<EOL>)<EOL><DEDENT>return _spec_from_modpath(modpath, path, context)<EOL>
given a mod path (i.e. split module / package name), return the
    corresponding file, giving priority to source file over precompiled
    file if it exists

    :type modpath: list or tuple
    :param modpath:
      split module's name (i.e name of a module or package split
      on '.')
      (this means explicit relative imports that start with dots have
      empty strings in this list!)

    :type path: list or None
    :param path:
      optional list of path where the module or package should be
      searched (use sys.path if nothing or None is given)

    :type context_file: str or None
    :param context_file:
      context file to consider, necessary if the identifier has been
      introduced using a relative import unresolvable in the actual
      context (i.e. modutils)

    :raise ImportError: if there is no such module in the directory

    :rtype: (str or None, import type)
    :return:
      the path to the module's file or None if it's an integrated
      builtin module such as 'sys'