human
Solve the following python programming problem given the following code:
@profiler.trace
def image_create(request, **kwargs):
assistant
#Here is the Python program you requested.

    """Create image.
    :param kwargs:
    * copy_from: URL from which Glance server should immediately copy
    the data and store it in its configured image store.
    * data: Form data posted from client.
    * location: URL where the data for this image already resides.
    In the case of \copy_from\ and \location\, the Glance server
    will give us a immediate response from create and handle the data
    asynchronously.
    In the case of \data\ the process of uploading the data may take
    some time and is handed off to a separate thread.
    """
    data = kwargs.pop('data', None)
    location = None
    if (VERSIONS.active >= 2):
        location = kwargs.pop('location', None)
    image = glanceclient(request).images.create(**kwargs)
    if (location is not None):
        glanceclient(request).images.add_location(image.id, location, {})
    if data:
        if isinstance(data, six.string_types):
            return ExternallyUploadedImage(image, request)
        elif isinstance(data, TemporaryUploadedFile):
            data.file.close_called = True
        elif isinstance(data, InMemoryUploadedFile):
            data = SimpleUploadedFile(data.name, data.read(), data.content_type)
        if (VERSIONS.active < 2):
            thread.start_new_thread(image_update, (request, image.id), {'data': data})
        else:
            def upload():
                try:
                    return glanceclient(request).images.upload(image.id, data)
                finally:
                    filename = str(data.file.name)
                    try:
                        os.remove(filename)
                    except OSError as e:
                        LOG.warning('Failed    to    remove    temporary    image    file    %(file)s    (%(e)s)', {'file': filename, 'e': e})
            thread.start_new_thread(upload, ())
    return Image(image)