def _Reformat(self, old_msg, sha1):
    new_msg = []

    for line in old_msg.splitlines():
      if not self._IsChangeId(line):
        new_msg.append(line)

    # Add a blank line between the message and the change id/reference
    try:
      if new_msg[-1].strip() != "":
        new_msg.append("")
    except __HOLE__:
      pass

    new_msg.append(self._GetReference(sha1))
    return "\n".join(new_msg)
dataset/ETHPy150Open esrlabs/git-repo/subcmds/cherry_pick.py/CherryPick._Reformat