code: def identify_ibids(line):
      
      ibid_match_txt = {}
      # Record details of each matched ibid:
      for m_ibid in re_ibid.finditer(line):
          ibid_match_txt[m_ibid.start()] = m_ibid.group(0)
          # Replace matched text in line with underscores:
          line = line[0:m_ibid.start()] + \
              "_" * len(m_ibid.group(0)) + \
              line[m_ibid.end():]
  
      return ibid_match_txt, line
docs: Find IBIDs within the line, record their position and length,
         and replace them with underscores.
         @param line: (string) the working reference line
         @return: (tuple) containing 2 dictionaries and a string:
           Dictionary:   matched IBID text: (Key: position of IBID in
                         line; Value: matched IBID text)
           String:       working line with matched IBIDs removed