<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def export_image_to_uri(self, image_id, uri, ibm_api_key=None):
 """Export image into the given object storage :param int image_id: The ID of the image :param string uri: The URI for object storage of the format swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> or cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud Object Storage :param string ibm_api_key: Ibm Api Key needed to communicate with IBM Cloud Object Storage """

        if 'cos://' in uri:
            return self.vgbdtg.copyToIcos({
                'uri': uri,
                'ibmApiKey': ibm_api_key
            }, id=image_id)
        else:
            return self.vgbdtg.copyToExternalSource({'uri': uri}, id=image_id)