def report(location, document):
    """
    Run reporter on document and return list of ReporterError instances.
    (Depending on the location it will or won't run anything.)

    Returns a list of `ReporterError`.
    """
    assert isinstance(location, six.string_types)

    if location.endswith('.py'):
        return report_pyflakes(document)
    else:
        return []