import six


def flatten(x):
    """Return a single flat list containing elements from nested lists."""
    result = []
    for el in x:
        if hasattr(el, '__iter__') and not isinstance(el, six.string_types):
            result.extend(flatten(el))
        else:
            result.append(el)
    return result