code: def relocate_model(part, target_parent, name=None, include_children=True):
      if target_parent.id in get_illegal_targets(part, include={part.id}):
          raise IllegalArgumentError('cannot relocate part "{}" under target parent "{}", because the target is part of '
                                     'its descendants'.format(part.name, target_parent.name))
      if not name:
          name = "CLONE - {}".format(part.name)
      part_desc = part._json_data['description']
      moved_part_model = target_parent.add_model(name=name, multiplicity=part.multiplicity)
      if part_desc:
          moved_part_model.edit(description=str(part_desc))
      get_mapping_dictionary().update({part.id: moved_part_model})
      list_of_properties_sorted_by_order = part.properties
      list_of_properties_sorted_by_order.sort(key=lambda x: x._json_data['order'])
      for prop in list_of_properties_sorted_by_order:
          prop_type = prop._json_data.get('property_type')
          desc = prop._json_data.get('description')
          unit = prop._json_data.get('unit')
          options = prop._json_data.get('options')
          if prop_type == PropertyType.REFERENCES_VALUE:
              referenced_part_ids = [referenced_part.id for referenced_part in prop.value]
              moved_prop = moved_part_model.add_property(name=prop.name, description=desc, property_type=prop_type,
                                                         default_value=referenced_part_ids)
          elif prop_type == PropertyType.ATTACHMENT_VALUE:
              moved_prop = moved_part_model.add_property(name=prop.name, description=desc, property_type=prop_type)
              if prop.value:
                  attachment_name = prop._json_data['value'].split('/')[-1]
                  with temp_chdir() as target_dir:
                      full_path = os.path.join(target_dir or os.getcwd(), attachment_name)
                      prop.save_as(filename=full_path)
                      moved_prop.upload(full_path)
          else:
              moved_prop = moved_part_model.add_property(name=prop.name, description=desc, property_type=prop_type,
                                                         default_value=prop.value, unit=unit, options=options)
          get_mapping_dictionary()[prop.id] = moved_prop
      if include_children:
          part.populate_descendants()
          for sub_part in part._cached_children:
              relocate_model(part=sub_part, target_parent=moved_part_model, name=sub_part.name,
                             include_children=include_children)
      return moved_part_model