<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def import_image_from_uri(self, name, uri, os_code=None, note=None, ibm_api_key=None, root_key_crn=None, wrapped_dek=None, cloud_init=False, byol=False, is_encrypted=False):
 """Import a new image from object storage. :param string name: Name of the new image :param string uri: The URI for an object storage object (.vhd/.iso file) of the format: swift://<objectStorageAccount>@<cluster>/<container>/<objectPath> or (.vhd/.iso/.raw file) of the format: cos://<regionName>/<bucketName>/<objectPath> if using IBM Cloud Object Storage :param string os_code: The reference code of the operating system :param string note: Note to add to the image :param string ibm_api_key: Ibm Api Key needed to communicate with ICOS and your KMS :param string root_key_crn: CRN of the root key in your KMS. Go to your KMS (Key Protect or Hyper Protect) provider to get the CRN for your root key. An example CRN: crn:v1:bluemix:public:hs-crypto:us-south:acctID:serviceID:key:keyID' Used only when is_encrypted is True. :param string wrapped_dek: Wrapped Data Encryption Key provided by your KMS. Used only when is_encrypted is True. :param boolean cloud_init: Specifies if image is cloud-init :param boolean byol: Specifies if image is bring your own license :param boolean is_encrypted: Specifies if image is encrypted """

        if 'cos://' in uri:
            return self.vgbdtg.createFromIcos({
                'name': name,
                'note': note,
                'operatingSystemReferenceCode': os_code,
                'uri': uri,
                'ibmApiKey': ibm_api_key,
                'crkCrn': root_key_crn,
                'wrappedDek': wrapped_dek,
                'cloudInit': cloud_init,
                'byol': byol,
                'isEncrypted': is_encrypted
            })
        else:
            return self.vgbdtg.createFromExternalSource({
                'name': name,
                'note': note,
                'operatingSystemReferenceCode': os_code,
                'uri': uri,
            })