Print download statistics for a package.

    \b
    Example:

        pypi stat requests

def stat(package, graph):
    """Print download statistics for a package.

    \b
    Example:

        pypi stat requests
    """
    client = requests.Session()
    for name_or_url in package:
        package = get_package(name_or_url, client)
        if not package:
            secho(u'Invalid name or URL: "{name}"'.format(name=name_or_url),
                  fg='red', file=sys.stderr)
            continue
        try:
            version_downloads = package.version_downloads
        except NotFoundError:
            secho(u'No versions found for "{0}". '
                  u'Skipping. . .'.format(package.name),
                  fg='red', file=sys.stderr)
            continue
        echo(u"Fetching statistics for '{url}'. . .".format(
            url=package.package_url))
        min_ver, min_downloads = package.min_version
        max_ver, max_downloads = package.max_version
        if min_ver is None or max_ver is None:
            raise click.ClickException('Package has no releases')
        avg_downloads = package.average_downloads
        total = package.downloads
        echo()
        header = u'Download statistics for {name}'.format(name=package.name)
        echo_header(header)
        if graph:
            echo()
            echo('Downloads by version')
            echo(package.chart())
        echo()
        echo("Min downloads:   {min_downloads:12,} ({min_ver})".format(
            **locals()))
        echo("Max downloads:   {max_downloads:12,} ({max_ver})".format(
            **locals()))
        echo("Avg downloads:   {avg_downloads:12,}".format(**locals()))
        echo("Total downloads: {total:12,}".format(**locals()))
        echo()
        echo_download_summary(package)
        echo()