<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_image(self, batch_id, image_id, image_properties=None):
 """Adds image to given batch."""

    if batch_id not in self._data:
      raise KeyError('Batch with ID "{0}" does not exist'.format(batch_id))
    if image_properties is None:
      image_properties = {}
    if not isinstance(image_properties, dict):
      raise ValueError('image_properties has to be dict, however it was: '
                       + str(type(image_properties)))
    self._data[batch_id]['images'][image_id] = image_properties.copy()