def METHOD_NAME(glob):
    if not isinstance(glob, str):
        raise ValueError("Glob pattern must be a string")
    pattern = fnmatch.translate(glob)
    # fnmatch adds special character to match the end of the string, so that when used
    # with re.match it, by default, matches the whole string. Here, it's going to be used
    # with re.search so it would be weird to enforce matching the suffix, but not the prefix.
    if pattern[-2:] == r"\Z":
        pattern = pattern[:-2]
    return pattern