Make a certificate signing request.

  :param OpenSSL.crypto.PKey pkey: A private key.
  :param str digest: A valid digest to use. For example, `sha512`.
  :param name: Key word arguments containing subject name parts: C, ST, L, O,
    OU, CN.
  :return: A certificate signing request.
  :rtype: :class:`OpenSSL.crypto.X509Request`

def make_certificate_signing_request(pkey, digest='sha512', **name):
  """Make a certificate signing request.

  :param OpenSSL.crypto.PKey pkey: A private key.
  :param str digest: A valid digest to use. For example, `sha512`.
  :param name: Key word arguments containing subject name parts: C, ST, L, O,
    OU, CN.
  :return: A certificate signing request.
  :rtype: :class:`OpenSSL.crypto.X509Request`

  """
  csr = crypto.X509Req()
  subj = csr.get_subject()
  subj.C = name.get('C', 'US')
  subj.ST = name.get('ST', 'CA')
  subj.L = name.get('L', 'Home')
  subj.O = name.get('O', 'Home')
  subj.OU = name.get('OU', 'Unit')
  subj.CN = name.get('CN', 'Common')
  csr.set_pubkey(pkey)
  csr.set_version(3)
  csr.sign(pkey, digest)
  return csr