'Wraps a private key in a PrivateKeyInfo structure
:param private_key:
A byte string or Asn1Value object of the private key
:param algorithm:
A unicode string of "rsa", "dsa" or "ec"
:return:
A PrivateKeyInfo object'

@classmethod
def wrap(cls, private_key, algorithm):

    if ((not isinstance(private_key, byte_cls)) and (not isinstance(private_key, Asn1Value))):
        raise TypeError(unwrap(u'\n                                                                private_key    must    be    a    byte    string    or    Asn1Value,    not    %s\n                                                                ', type_name(private_key)))
    if (algorithm == u'rsa'):
        if (not isinstance(private_key, RSAPrivateKey)):
            private_key = RSAPrivateKey.load(private_key)
        params = Null()
    elif (algorithm == u'dsa'):
        if (not isinstance(private_key, DSAPrivateKey)):
            private_key = DSAPrivateKey.load(private_key)
        params = DSAParams()
        params[u'p'] = private_key[u'p']
        params[u'q'] = private_key[u'q']
        params[u'g'] = private_key[u'g']
        public_key = private_key[u'public_key']
        private_key = private_key[u'private_key']
    elif (algorithm == u'ec'):
        if (not isinstance(private_key, ECPrivateKey)):
            private_key = ECPrivateKey.load(private_key)
        else:
            private_key = private_key.copy()
        params = private_key[u'parameters']
        del private_key[u'parameters']
    else:
        raise ValueError(unwrap(u'\n                                                                algorithm    must    be    one    of    "rsa",    "dsa",    "ec",    not    %s\n                                                                ', repr(algorithm)))
    private_key_algo = PrivateKeyAlgorithm()
    private_key_algo[u'algorithm'] = PrivateKeyAlgorithmId(algorithm)
    private_key_algo[u'parameters'] = params
    container = cls()
    container._algorithm = algorithm
    container[u'version'] = Integer(0)
    container[u'private_key_algorithm'] = private_key_algo
    container[u'private_key'] = private_key
    if (algorithm == u'dsa'):
        container._public_key = public_key
    return container
