code: def rename_key(pki_dir, id_, new_id):
      '''
      Rename a key, when an instance has also been renamed
      '''
      oldkey = os.path.join(pki_dir, 'minions', id_)
      newkey = os.path.join(pki_dir, 'minions', new_id)
      if os.path.isfile(oldkey):
          os.rename(oldkey, newkeyf rename_key(pki_dir, id_, new_id):
      '''
      Rename a key, when an instance has also been renamed
      '''
      oldkey = os.path.join(pki_dir, 'minions', id_)
      newkey = os.path.join(pki_dir, 'minions', new_id)
      if os.path.isfile(oldkey):
          os.rename(oldkey, newkey)
docs: Rename a key, when an instance has also been renamed