'Calculates the histogram of the image - async version.
Args:
rpc: An optional UserRPC object.
Returns:
rpc: A UserRPC object.
Raises:
NotImageError when the image data given is not an image.
BadImageError when the image data given is corrupt.
LargeImageError when the image data given is too large to process.
Error when something unknown, but bad, happens.'

def histogram_async(self, rpc=None):

    request = images_service_pb.ImagesHistogramRequest()
    response = images_service_pb.ImagesHistogramResponse()
    self._set_imagedata(request.mutable_image())
    def get_histogram_hook(rpc):
        'Check    success,    handles    exceptions    and    returns    the    converted    RPC    result.\n\n                        Args:\n                                rpc:    A    UserRPC    object.\n\n                        Raises:\n                                See    docstring    for    histogram_async    for    more    details.\n                        '
        try:
            rpc.check_success()
        except apiproxy_errors.ApplicationError as e:
            raise _ToImagesError(e, self._blob_key)
        histogram = rpc.response.histogram()
        return [histogram.red_list(), histogram.green_list(), histogram.blue_list()]
    return _make_async_call(rpc, 'Histogram', request, response, get_histogram_hook, None)
