code: def open(self, external_dir=None):
          
          if self.kind == 'data':
              with io.BytesIO(self._data.data) as f:
                  yield f
          elif self.kind == 'external':
              filepath = self._data.linked_file[b'fullPath'].value
              filepath = filepath.replace('\x00', '').replace('file://', '')
              if not os.path.exists(filepath):
                  filepath = self._data.linked_file[b'relPath'].value
                  filepath = filepath.replace('\x00', '')
                  if external_dir is not None:
                      filepath = os.path.join(external_dir, filepath)
              if not os.path.exists(filepath):
                  raise FileNotFoundError(filepath)
              with open(filepath, 'rb') as f:
                  yield f
          else:
              raise NotImplementedError('alias is not supported.')
docs: Open the smart object as binary IO.
  
          :param external_dir: Path to the directory of the external file.
  
          Example::
  
              with layer.smart_object.open() as f:
                  data = f.read()