def modname_to_modpath(modname, hide_init=True, hide_main=False, sys_path=None):
modpath = _syspath_modname_to_modpath(modname, sys_path)<EOL>if modpath is None:<EOL><INDENT>return None<EOL><DEDENT>modpath = normalize_modpath(modpath, hide_init=hide_init,<EOL>hide_main=hide_main)<EOL>return modpath<EOL>
Finds the path to a python module from its name.

Determines the path to a python module without directly import it

Converts the name of a module (__name__) to the path (__file__) where it is
located without importing the module. Returns None if the module does not
exist.

Args:
    modname (str): module filepath
    hide_init (bool): if False, __init__.py will be returned for packages
    hide_main (bool): if False, and hide_init is True, __main__.py will be
        returned for packages, if it exists.
    sys_path (list): if specified overrides `sys.path` (default None)

Returns:
    str: modpath - path to the module, or None if it doesn't exist

CommandLine:
    python -m xdoctest.static_analysis modname_to_modpath:0
    pytest  /home/joncrall/code/xdoctest/xdoctest/static_analysis.py::modname_to_modpath:0

Example:
    >>> modname = 'xdoctest.__main__'
    >>> modpath = modname_to_modpath(modname, hide_main=False)
    >>> assert modpath.endswith('__main__.py')
    >>> modname = 'xdoctest'
    >>> modpath = modname_to_modpath(modname, hide_init=False)
    >>> assert modpath.endswith('__init__.py')
    >>> modpath = basename(modname_to_modpath('_ctypes'))
    >>> assert 'ctypes' in modpath