code: def copy_ecu(ecu_or_glob, source_db, target_db):
      # type: (typing.Union[cm.Ecu, str], cm.CanMatrix, cm.CanMatrix) -> None
      
      # check whether ecu_or_glob is object or symbolic name
      if isinstance(ecu_or_glob, cm.Ecu):
          ecu_list = [ecu_or_glob]
      else:
          ecu_list = source_db.glob_ecus(ecu_or_glob)
  
      for ecu in ecu_list:
          target_db.add_ecu(copy.deepcopy(ecu))
  
          # copy all ecu-defines
          for attribute in ecu.attributes:
              if attribute not in target_db.ecu_defines:
                  target_db.add_ecu_defines(
                      copy.deepcopy(attribute), copy.deepcopy(source_db.ecu_defines[attribute].definition))
                  target_db.add_define_default(
                      copy.deepcopy(attribute), copy.deepcopy(source_db.ecu_defines[attribute].defaultValue))
              # update enum data types if needed:
              if source_db.ecu_defines[attribute].type == 'ENUM':
                  temp_attr = ecu.attribute(attribute, db=source_db)
                  if temp_attr not in target_db.ecu_defines[attribute].values:
                      target_db.ecu_defines[attribute].values.append(copy.deepcopy(temp_attr))
                      target_db.ecu_defines[attribute].update()
docs: Copy ECU(s) identified by Name or as Object from source CAN matrix to target CAN matrix.
      This function additionally copy all relevant Defines.
  
      :param ecu_or_glob: Ecu instance or glob pattern for Ecu name
      :param source_db: Source CAN matrix
      :param target_db: Destination CAN matrix