code: def get_agent_rule_str(agent):
      
      rule_str_list = [_n(agent.name)]
      # If it's a molecular agent
      if isinstance(agent, ist.Agent):
          for mod in agent.mods:
              mstr = abbrevs[mod.mod_type]
              if mod.residue is not None:
                  mstr += mod.residue
              if mod.position is not None:
                  mstr += mod.position
              rule_str_list.append('%s' % mstr)
          for mut in agent.mutations:
              res_from = mut.residue_from if mut.residue_from else 'mut'
              res_to = mut.residue_to if mut.residue_to else 'X'
              if mut.position is None:
                  mut_site_name = res_from
              else:
                  mut_site_name = res_from + mut.position
              mstr = mut_site_name + res_to
              rule_str_list.append(mstr)
          if agent.bound_conditions:
              for b in agent.bound_conditions:
                  if b.is_bound:
                      rule_str_list.append(_n(b.agent.name))
                  else:
                      rule_str_list.append('n' + _n(b.agent.name))
          if agent.location is not None:
              rule_str_list.append(_n(agent.location))
          if agent.activity is not None:
              if agent.activity.is_active:
                  rule_str_list.append(agent.activity.activity_type[:3])
              else:
                  rule_str_list.append(agent.activity.activity_type[:3] + '_inact')
      rule_str = '_'.join(rule_str_list)
      return rule_str
docs: Construct a string from an Agent as part of a PySB rule name.