def determine_archive_version_generic(name, leading_terms, trailing_terms):
    """
    Given an archive file name, tries to get version information. Generic version that can cut off leading and trailing
    terms and converts to lower case. Give the most special terms first in the list. As many cut offs as possible are
    performed.
    """
    # to lower case
    name = name.lower()

    # cut leading terms
    for t in leading_terms:
        if name.startswith(t):
            name = name[len(t):]

    # cut trailing terms
    for t in trailing_terms:
        if name.endswith(t):
            name = name[:-len(t)]
    return name