code: def get_site_pattern(agent):
      
      if not isinstance(agent, ist.Agent):
          return {}
      pattern = {}
      # Handle bound conditions
      for bc in agent.bound_conditions:
          # Here we make the assumption that the binding site
          # is simply named after the binding partner
          if bc.is_bound:
              pattern[get_binding_site_name(bc.agent)] = ANY
          else:
              pattern[get_binding_site_name(bc.agent)] = None
  
      # Handle modifications
      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)
  
      # Handle mutations
      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
  
      # Handle location
      if agent.location is not None:
          pattern['loc'] = _n(agent.location)
  
      # Handle activity
      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
docs: Construct a dictionary of Monomer site states from an Agent.
  
      This crates the mapping to the associated PySB monomer from an
      INDRA Agent object.