def contained_in(filename, directory):
    """Test if a file is located within the given directory."""
    filename = os.path.normcase(os.path.abspath(filename))
    directory = os.path.normcase(os.path.abspath(directory))
    return os.path.commonprefix([filename, directory]) == directory
Test if a file is located within the given directory.
product/gradle-plugin/src/main/python/pip/_vendor/pep517/_in_process.py