code: def create_or_reference_batch(self):
          
          client = self.aq_parent
          batch_headers = self.get_batch_header_values()
          if not batch_headers:
              return False
          # if the Batch's Title is specified and exists, no further
          # action is required. We will just set the Batch field to
          # use the existing object.
          batch_title = batch_headers.get('title', False)
          if batch_title:
              existing_batch = [x for x in client.objectValues('Batch')
                                if x.title == batch_title]
              if existing_batch:
                  self.setBatch(existing_batch[0])
                  return existing_batch[0]
          # If the batch title is specified but does not exist,
          # we will attempt to create the bach now.
          if 'title' in batch_headers:
              if 'id' in batch_headers:
                  del (batch_headers['id'])
              if '' in batch_headers:
                  del (batch_headers[''])
              batch = _createObjectByType('Batch', client, tmpID())
              batch.processForm()
              batch.edit(**batch_headers)
              self.setBatch(batch)
docs: Save reference to batch, if existing batch specified
          Create new batch, if possible with specified values