code: def reference(self, t, i):
          
          octal = self.get_octal(t, i)
          if t in _OCTAL and octal:
              self.parse_octal(octal, i)
          elif (t in _DIGIT or t == 'g') and not self.use_format:
              group = self.get_group(t, i)
              if not group:
                  group = self.get_named_group(t, i)
              self.handle_group('\\' + group)
          elif t in _STANDARD_ESCAPES:
              self.get_single_stack()
              self.result.append('\\' + t)
          elif t == "l":
              self.single_case(i, _LOWER)
          elif t == "L":
              self.span_case(i, _LOWER)
          elif t == "c":
              self.single_case(i, _UPPER)
          elif t == "C":
              self.span_case(i, _UPPER)
          elif t == "E":
              self.end_found = True
          elif not self.is_bytes and t == "U":
              self.parse_unicode(i, True)
          elif not self.is_bytes and t == "u":
              self.parse_unicode(i)
          elif not self.is_bytes and t == "N":
              self.parse_named_unicode(i)
          elif t == "x":
              self.parse_bytes(i)
          elif self.use_format and t in _CURLY_BRACKETS:
              self.result.append('\\\\')
              self.handle_format(t, i)
          elif self.use_format and t == 'g':
              self.result.append('\\\\')
              self.result.append(t)
          else:
              value = '\\' + t
              self.get_single_stack()
              if self.span_stack:
                  value = self.convert_case(value, self.span_stack[-1])
              self.result.append(value)
docs: Handle references.