import re


def _matches(name, patterns):
    """
    If name matches any pattern in patterns return True
    :param name: (str) Any string
    :param patterns: (iter) Iterable that contains iterables of strings that define prefix and suffix patterns to
    match to. Prefix or suffix may be empty.
    :return: (bool)
    """

    for p in patterns:
        prefix, suffix = p + (len(p) == 1) * ['']
        pattern = r'^({prefix}).*({suffix})$'.format(prefix=prefix, suffix=suffix)
        matches = bool(re.search(pattern, name))
        if matches:
            return True

    return False