Return the average build duration for a package (or container).

    :param connection: txkoji.Connection
    :param package: package name
    :returns: deferred that when fired returns a datetime.timedelta object

def average_build_duration(connection, package):
    """
    Return the average build duration for a package (or container).

    :param connection: txkoji.Connection
    :param package: package name
    :returns: deferred that when fired returns a datetime.timedelta object
    """
    if isinstance(package, str) and package.endswith('-container'):
        return average_last_builds(connection, package)
    return connection.getAverageBuildDuration(package)