Get information about all builds of a package.

        Calls "listBuilds" XML-RPC, with an enhancement: you can also pass a
        string here for the package name instead of the package ID number.
        See https://pagure.io/koji/issue/1209 for implementing this
        server-side.

        :param package: ``int`` (packageID) or ``str`` (package name).
        :returns: deferred that when fired returns a list of Build objects
                  for this package.

def listBuilds(self, package, **kwargs):
        """
        Get information about all builds of a package.

        Calls "listBuilds" XML-RPC, with an enhancement: you can also pass a
        string here for the package name instead of the package ID number.
        See https://pagure.io/koji/issue/1209 for implementing this
        server-side.

        :param package: ``int`` (packageID) or ``str`` (package name).
        :returns: deferred that when fired returns a list of Build objects
                  for this package.
        """
        if isinstance(package, int):
            package_id = package
        else:
            package_data = yield self.getPackage(package)
            if package_data is None:
                defer.returnValue([])
            package_id = package_data.id
        data = yield self.call('listBuilds', package_id, **kwargs)
        builds = []
        for bdata in data:
            build = Build.fromDict(bdata)
            build.connection = self
            builds.append(build)
        defer.returnValue(builds)