def METHOD_NAME(pats, exclude=None):
    """ glob using a list of patterns and removing duplicate files,
        exclude name in the list for which the callback exclude(name) return true
        example: advanced_glob(['*.jpg','*.gif'],exclude=lambda n:len(n)>20) return a list of all JPG and GIF files
                 which have names shorter then 20 characters
    """
    unique = {}
    if exclude is None:
        def exclude(n):
            return 0
    for p in pats:
        for f in glob.glob(p):
            unique[f] = 1
    return [name for name in unique.keys() if not exclude(name)]