code: def rename_references(
      app, what, name, obj, options, lines, reference_offset=[0]
  ):
      # replace reference numbers so that there are no duplicates
      references = []
      for line in lines:
          line = line.strip()
          m = re.match(
              sixu("^.. \\[(%s)\\]") % app.config.numpydoc_citation_re,
              line,
              re.I,
          )
          if m:
              references.append(m.group(1))
  
      if references:
          for i, line in enumerate(lines):
              for r in references:
                  if re.match(sixu("^\\d+$"), r):
                      new_r = sixu("R%d") % (
                          reference_offset[0] + int(r)
                      )
                  else:
                      new_r = sixu("%s%d") % (r, reference_offset[0])
                  lines[i] = lines[i].replace(
                      sixu("[%s]_") % r, sixu("[%s]_") % new_r
                  )
                  lines[i] = lines[i].replace(
                      sixu(".. [%s]") % r, sixu(".. [%s]") % new_r
                  )
  
      reference_offset[0] += len(references)
  
imports: from __future__ import division, absolute_import, print_function
  import sys
  import re
  import pydoc
  import sphinx
  import inspect
  import collections
  from .docscrape_sphinx import get_doc_object, SphinxDocString
  from docutils.statemachine import ViewList
  from sphinx.domains.c import CDomain
  from sphinx.domains.python import PythonDomain
label_desc: Use image node_id 1 for calling a global function with example usage: rename_references(app, what, name, obj, options, lines, reference_offset) without return types