code: def process_rules(rules, fixed_text, cur = 0, cur_end = 1):
      
      replaced = ''
      # iterate through rules
      for rule in rules:
          matched = False
          # iterate through matches
          for match in rule['matches']:
              matched = process_match(match, fixed_text, cur, cur_end)
              # Break out of loop if we dont' have a match. Here we are
              # trusting avrodict to have listed matches sequentially
              if not matched:
                  break
          # If a match is found, stop looping through rules any further
          if matched:
              replaced = rule['replace']
              break
  
      # if any match has been found return replace value
      if matched:
          return replaced
      else:
          return None
docs: Process rules matched in pattern and returns suitable replacement
  
      If any rule's condition is satisfied, output the rules "replace",
      else output None