code: def add_raw_entity(self, entity: dict) -> dict:
          needed_in_entity = set([
              'label',
              'type',
          ])
          options_in_entity = set([
              'label',
              'type',
              'definition',
              'comment',
              'superclass',
              'synonyms',
              'existing_ids'
          ])
          prime_entity_url = self.base_url + 'ilx/add'
          add_entity_url = self.base_url + 'term/add'
          if (set(entity) & needed_in_entity) != needed_in_entity:
              raise self.MissingKeyError(
                  'You need key(s): '+ str(needed_in_entity - set(entity)))
          elif (set(entity) | options_in_entity) != options_in_entity:
              raise self.IncorrectKeyError(
                  'Unexpected key(s): ' + str(set(entity) - options_in_entity))
          entity['type'] = entity['type'].lower()
          if entity['type'] not in ['term', 'relationship', 'annotation', 'cde', 'fde', 'pde']:
              raise TypeError(
                  'Entity should be one of the following: ' +
                  'term, relationship, annotation, cde, fde, pde')
          if entity.get('superclass'):
              entity = self.process_superclass(entity)
          if entity.get('synonyms'):
              entity = self.process_synonyms(entity)
          if entity.get('existing_ids'):
              entity = self.process_existing_ids(entity)
          entity['uid'] = self.user_id
          entity['term'] = entity.pop('label')
          ilx_data = self.post(
              url = prime_entity_url,
              data = entity.copy(),
          )
          if ilx_data.get('ilx'):
              ilx_id = ilx_data['ilx']
          else:
              ilx_id = ilx_data['fragment']
          entity['label'] = entity.pop('term')
          entity['ilx'] = ilx_id
          output = self.post(
              url = add_entity_url,
              data = entity.copy(),
          )
          if output.get('errormsg'):
              if 'already exists' in output['errormsg'].lower():
                  prexisting_data = self.check_scicrunch_for_label(entity['label'])
                  if prexisting_data:
                      print(
                          'You already added entity', entity['label'],
                          'with ILX ID:', prexisting_data['ilx'])
                      return prexisting_data
                  self.Error(output)
              self.Error(output)
          output = self.get_entity(output['ilx'])
          return output