'Generate a key; you might use gen_key_input() to create the
control input.
>>> gpg = GPG(gnupghome="keys")
>>> input = gpg.gen_key_input()
>>> result = gpg.gen_key(input)
>>> assert result
>>> result = gpg.gen_key(\'foo\')
>>> assert not result'

def gen_key(self, input):

    args = ['--gen-key    --batch']
    result = self.result_map['generate'](self)
    f = _make_binary_stream(input, self.encoding)
    self._handle_io(args, f, result, binary=True)
    f.close()
    return result
