code: def export_ownertrust(cls, trustdb=None):
      
      if trustdb is None:
          trustdb = os.path.join(cls.homedir, 'trustdb.gpg')
  
      try:
          os.rename(trustdb, trustdb + '.bak')
      except (OSError, IOError) as err:
          log.debug(str(err))
  
      export_proc = cls._open_subprocess(['--export-ownertrust'])
      tdb = open(trustdb, 'wb')
      _util._threaded_copy_data(export_proc.stdout, tdb)
      export_proc.wait()
docs: Export ownertrust to a trustdb file.
  
      If there is already a file named :file:`trustdb.gpg` in the current GnuPG
      homedir, it will be renamed to :file:`trustdb.gpg.bak`.
  
      :param string trustdb: The path to the trustdb.gpg file. If not given,
                             defaults to ``'trustdb.gpg'`` in the current GnuPG
                             homedir.