def strip_package(package_parts, module_file):
    "Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a\n    ``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting\n    from the left, this function will strip the parts of the path\n    matching the package parts and return a new string\n    (e.g ``jaz/rock/roll.py``).\n\n    The function will work as expected for either Windows or Unix-style\n    ``module_file`` and this independently of the platform.\n    "
    if ((not package_parts) or os.path.isabs(module_file)):
        return module_file
    package = '/'.join(package_parts)
    module_dir = os.path.dirname(module_file.replace('\\', '/'))
    module_dir = module_dir[:len(package)]
    return (module_file[(len(package) + 1):] if ((package != '') and module_dir.startswith(package)) else module_file)
Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a
``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting
from the left, this function will strip the parts of the path
matching the package parts and return a new string
(e.g ``jaz/rock/roll.py``).

The function will work as expected for either Windows or Unix-style
``module_file`` and this independently of the platform.
def strip_package(package_parts, module_file):
    "Given ``package_parts`` (e.g. ``['foo', 'bar']``) and a\n    ``module_file`` (e.g. ``foo/bar/jaz/rock/roll.py``), starting\n    from the left, this function will strip the parts of the path\n    matching the package parts and return a new string\n    (e.g ``jaz/rock/roll.py``).\n\n    The function will work as expected for either Windows or Unix-style\n    ``module_file`` and this independently of the platform.\n    "
    if ((not package_parts) or os.path.isabs(module_file)):
        return module_file
    package = '/'.join(package_parts)
    module_dir = os.path.dirname(module_file.replace('\\', '/'))
    module_dir = module_dir[:len(package)]
    return (module_file[(len(package) + 1):] if ((package != ) and module_dir.startswith(package)) else module_file)