src/lsi/utils/hosts.py
def _match_regex(regex, obj):
    """
    Returns true if the regex matches the object, or a string in the object
    if it is some sort of container.

    :param regex: A regex.
    :type regex: ``regex``
    :param obj: An arbitrary object.
    :type object: ``object``

    :rtype: ``bool``
    """
    if isinstance(obj, six.string_types):
        return len(regex.findall(obj)) > 0
    elif isinstance(obj, dict):
        return _match_regex(regex, obj.values())
    elif hasattr(obj, '__iter__'):
        # Object is a list or some other iterable.
        return any(_match_regex(regex, s)
                   for s in obj if isinstance(s, six.string_types))
    else:
        return False
def _match_regex(regex, obj):
    if isinstance(obj, six.string_types):
        return len(regex.findall(obj)) > 0
    elif isinstance(obj, dict):
        return _match_regex(regex, obj.values())
    elif hasattr(obj, '__iter__'):
        # Object is a list or some other iterable.
        return any(_match_regex(regex, s)
                   for s in obj if isinstance(s, six.string_types))
    else:
        return False
def _match_regex ( regex , obj ) : if isinstance ( obj , six . string_types ) : return len ( regex . findall ( obj ) ) > 0 elif isinstance ( obj , dict ) : return _match_regex ( regex , obj . values ( ) ) elif hasattr ( obj , '__iter__' ) : # Object is a list or some other iterable. return any ( _match_regex ( regex , s ) for s in obj if isinstance ( s , six . string_types ) ) else : return False
Returns true if the regex matches the object, or a string in the object
    if it is some sort of container.

    :param regex: A regex.
    :type regex: ``regex``
    :param obj: An arbitrary object.
    :type object: ``object``

    :rtype: ``bool``
Returns true if the regex matches the object or a string in the object if it is some sort of container .