Check to see if dir is a subdirectory of (or matches) check_dir
    directories. Return True if the dir is a subdirectory of or matches any of
    the check directories.

    :param dir: String path of directory that may or may not be a
        subdirectory of or match the directories listed in check_dirs.
    :param check_dirs: List of string paths of directories that may be parents
        of dir
    :return: True if dir is a child/matches any of the directories in check.
        False otherwise

def is_dir_inside(dir, check_dirs):
    """
    Check to see if dir is a subdirectory of (or matches) check_dir
    directories. Return True if the dir is a subdirectory of or matches any of
    the check directories.

    :param dir: String path of directory that may or may not be a
        subdirectory of or match the directories listed in check_dirs.
    :param check_dirs: List of string paths of directories that may be parents
        of dir
    :return: True if dir is a child/matches any of the directories in check.
        False otherwise
    """
    for check_dir in check_dirs:
        if os.path.commonprefix([dir, check_dir]) == check_dir:
            return True
    return False