code: def get_site_pattern(agent):
      if not isinstance(agent, ist.Agent):
          return {}
      pattern = {}
      for bc in agent.bound_conditions:
          if bc.is_bound:
              pattern[get_binding_site_name(bc.agent)] = ANY
          else:
              pattern[get_binding_site_name(bc.agent)] = None
      for mod in agent.mods:
          mod_site_str = abbrevs[mod.mod_type]
          if mod.residue is not None:
              mod_site_str = mod.residue
          mod_pos_str = mod.position if mod.position is not None else ''
          mod_site = ('%s%s' % (mod_site_str, mod_pos_str))
          site_states = states[mod.mod_type]
          if mod.is_modified:
              pattern[mod_site] = (site_states[1], WILD)
          else:
              pattern[mod_site] = (site_states[0], WILD)
      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
          pattern[mut_site_name] = res_to
      if agent.location is not None:
          pattern['loc'] = _n(agent.location)
      if agent.activity is not None:
          active_site_name = agent.activity.activity_type
          if agent.activity.is_active:
              active_site_state = 'active'
          else:
              active_site_state = 'inactive'
          pattern[active_site_name] = active_site_state
      return pattern