'Return a private key corresponding to this LSH private key string.
The LSH private key string format is::
<s-expression: (\'private-key\', (<key type>, (<name>, <value>)+))>
The names for a RSA (key type \'rsa-pkcs1-sha1\') key are: n, e, d, p, q.
The names for a DSA (key type \'dsa\') key are: y, g, p, q, x.
@type data: L{bytes}
@param data: The key data.
@return: A new key.
@rtype: L{twisted.conch.ssh.keys.Key}
@raises BadKeyError: if the key type is unknown'

@classmethod
def _fromString_PRIVATE_LSH(cls, data):

    sexp = sexpy.parse(data)
    assert (sexp[0] == 'private-key')
    kd = {}
    for (name, data) in sexp[1][1:]:
        kd[name] = common.getMP(common.NS(data))[0]
    if (sexp[1][0] == 'dsa'):
        assert (len(kd) == 5), len(kd)
        return cls._fromDSAComponents(y=kd['y'], g=kd['g'], p=kd['p'], q=kd['q'], x=kd['x'])
    elif (sexp[1][0] == 'rsa-pkcs1'):
        assert (len(kd) == 8), len(kd)
        if (kd['p'] > kd['q']):
            (kd['p'], kd['q']) = (kd['q'], kd['p'])
        return cls._fromRSAComponents(n=kd['n'], e=kd['e'], d=kd['d'], p=kd['p'], q=kd['q'])
    else:
        raise BadKeyError(('unknown    lsh    key    type    %s' % (sexp[1][0],)))
