code: def _replace_reference(self, var):
          
  
          if var.type not in "cgmnr":
              raise HGVSUnsupportedOperationError("Can only update references for type c, g, m, n, r")
  
          if var.posedit.edit.type == "ins":
              # insertions have no reference sequence (zero-width), so return as-is
              return var
          if var.posedit.edit.type == "con":
              # conversions have no reference sequence (zero-width), so return as-is
              return var
  
          pos = var.posedit.pos
          if ((isinstance(pos.start, hgvs.location.BaseOffsetPosition) and pos.start.offset != 0)
                  or (isinstance(pos.end, hgvs.location.BaseOffsetPosition) and pos.end.offset != 0)):
              _logger.info("Can't update reference sequence for intronic variant {}".format(var))
              return var
  
          # For c. variants, we need coords on underlying sequences
          if var.type == "c":
              tm = self._fetch_AlignmentMapper(
                  tx_ac=var.ac, alt_ac=var.ac, alt_aln_method="transcript")
              pos = tm.c_to_n(var.posedit.pos)
          else:
              pos = var.posedit.pos
          seq = self.hdp.get_seq(var.ac, pos.start.base - 1, pos.end.base)
  
          edit = var.posedit.edit
          if edit.ref != seq:
              _logger.debug("Replaced reference sequence in {var} with {seq}".format(
                  var=var, seq=seq))
              edit.ref = seq
  
          return var
docs: fetch reference sequence for variant and update (in-place) if necessary