def generate_glob_by_extension(extension):
    """
    Generates a glob that matches the given extension, case-insensitively.

    Example
    -------
    For '.po' files, the generated glob is '*.[pP][oO]'
    """
    extension = extension.lstrip(".")

    case_insensitive_char_list = ["[{0}{1}]".format(char, char.upper()) for char in extension]
    glob = "".join(case_insensitive_char_list)

    return "*.{0}".format(glob)