from contextlib import suppress


def from_traversable_resources(spec):
    """
    If the spec.loader implements TraversableResources,
    directly or implicitly, it will have a ``files()`` method.
    """
    with suppress(AttributeError):
        return spec.loader.files()