code: def get_create_base_agent(self, agent):
          try:
              base_agent = self.agents[_n(agent.name)]
          except KeyError:
              base_agent = BaseAgent(_n(agent.name))
              self.agents[_n(agent.name)] = base_agent
          if isinstance(agent, Agent):
              for bc in agent.bound_conditions:
                  bound_base_agent = self.get_create_base_agent(bc.agent)
                  bound_base_agent.create_site(get_binding_site_name(agent))
                  base_agent.create_site(get_binding_site_name(bc.agent))
              for mc in agent.mods:
                  base_agent.create_mod_site(mc)
              for mc in agent.mutations:
                  res_from = mc.residue_from if mc.residue_from else 'mut'
                  res_to = mc.residue_to if mc.residue_to else 'X'
                  if mc.position is None:
                      mut_site_name = res_from
                  else:
                      mut_site_name = res_from + mc.position
                  base_agent.create_site(mut_site_name, states=['WT', res_to])
              if agent.location is not None:
                  base_agent.create_site('loc', [_n(agent.location)])
              if agent.activity is not None:
                  site_name = agent.activity.activity_type
                  base_agent.create_site(site_name, ['inactive', 'active'])
          for db_name, db_ref in agent.db_refs.items():
              base_agent.db_refs[db_name] = db_ref
          return base_agent