'Used by :func:`list_catalogs` and :func:`list_catalogs_by_url`.'

@staticmethod
def _match_pattern(all_keys, pattern, sort):

    if ((pattern is None) or (len(all_keys) == 0)):
        out_arr = all_keys
    else:
        pattern = re.compile(fnmatch.translate(((u'*' + pattern) + u'*')), re.IGNORECASE)
        out_arr = [s for s in all_keys if pattern.match(s)]
    if sort:
        out_arr.sort()
    return out_arr
