<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def update_device(self, device_id, **kwargs):
 """Update existing device in catalog. .. code-block:: python updated_device = api.update_device( existing_device.id, certificate_fingerprint = "something new" ) :param str device_id: The ID of the device to update (Required) :param obj custom_attributes: Up to 5 custom JSON attributes :param str description: The description of the device :param str name: The name of the device :param str alias: The alias of the device :param str device_type: The endpoint type of the device - e.g. if the device is a gateway :param str host_gateway: The endpoint_name of the host gateway, if appropriate :param str certificate_fingerprint: Fingerprint of the device certificate :param str certificate_issuer_id: ID of the issuer of the certificate :returns: the updated device object :rtype: Device """

        api = self._get_api(device_directory.DefaultApi)
        device = Device._create_request_map(kwargs)
        body = DeviceDataPostRequest(**device)
        return Device(api.device_update(device_id, body))