code: def generate_keypair(curve='secp160r1', randfunc=None):
      
      if randfunc is None:
          randfunc = Crypto.Random.new().read
      curve = Curve.by_name(curve)
      raw_privkey = randfunc(curve.order_len_bin)
      privkey = serialize_number(deserialize_number(raw_privkey), SER_COMPACT)
      pubkey = str(passphrase_to_pubkey(privkey))
      return (privkey, pubkey)
docs: Convenience function to generate a random
          new keypair (passphrase, pubkey).