code: def sign_apk(filename, keystore, storepass):
      
      from subprocess import Popen, PIPE, STDOUT
      # TODO use apksigner instead of jarsigner
      cmd = Popen([androconf.CONF["BIN_JARSIGNER"], "-sigalg", "MD5withRSA",
                   "-digestalg", "SHA1", "-storepass", storepass, "-keystore",
                   keystore, filename, "alias_name"],
                  stdout=PIPE,
                  stderr=STDOUT)
      stdout, stderr = cmd.communicate()
docs: Use jarsigner to sign an APK file.
  
      :param filename: APK file on disk to sign (path)
      :param keystore: path to keystore
      :param storepass: your keystorage passphrase