code: def create_object(container, portal_type, **data):
      
  
      if "id" in data:
          # always omit the id as senaite LIMS generates a proper one
          id = data.pop("id")
          logger.warn("Passed in ID '{}' omitted! Senaite LIMS "
                      "generates a proper ID for you" .format(id))
  
      try:
          # Special case for ARs
          # => return immediately w/o update
          if portal_type == "AnalysisRequest":
              obj = create_analysisrequest(container, **data)
              # Omit values which are already set through the helper
              data = u.omit(data, "SampleType", "Analyses")
              # Set the container as the client, as the AR lives in it
              data["Client"] = container
          # Standard content creation
          else:
              # we want just a minimun viable object and set the data later
              obj = api.create(container, portal_type)
              # obj = api.create(container, portal_type, **data)
      except Unauthorized:
          fail(401, "You are not allowed to create this content")
  
      # Update the object with the given data, but omit the id
      try:
          update_object_with_data(obj, data)
      except APIError:
  
          # Failure in creation process, delete the invalid object
          container.manage_delObjects(obj.id)
          # reraise the error
          raise
  
      return obj
docs: Creates an object slug
  
      :returns: The new created content object
      :rtype: object