docs: def generate_certificate_pure_python(common_name, size=DEFAULT_KEY_SIZE,
                                          digest=DEFAULT_DIGEST):
      '''
          Generate private key and certificate for https
      '''
      private_key = OpenSSL.crypto.PKey()
      private_key.generate_key(TYPE_RSA, size)
  
      request = OpenSSL.crypto.X509Req()
      subject = request.get_subject()
      setattr(subject, 'CN', common_name)
      request.set_pubkey(private_key)
      request.sign(private_key, digest)
  
      certificate = OpenSSL.crypto.X509()
      certificate.set_serial_number(0)
      certificate.gmtime_adj_notBefore(0)
      certificate.gmtime_adj_notAfter(60 * 60 * 24 * 365 * 5)
      certificate.set_issuer(request.get_subject())
      certificate.set_subject(request.get_subject())
      certificate.set_pubkey(request.get_pubkey())
      certificate.sign(private_key, digest)
  
      private_key_path = '{}/{}.key'.format(CERTIFICATES_PATH, common_name)
      if not os.path.isfile(private_key_path):
          print 'Write {}'.format(private_key_path)
          with open(private_key_path, 'w+') as private_key_file:
              private_key_file.write(
                  OpenSSL.crypto.dump_privatekey(FILETYPE_PEM,
                                                 private_key).decode('utf-8')
              )
          helpers.file_rights(private_key_path, mode=0400, uid=0, gid=0)
      else:
          print 'Already exist: {}'.format(private_key_path)
  
      certificate_path = '{}/{}.crt'.format(CERTIFICATES_PATH, common_name)
      if not os.path.isfile(certificate_path):
          print 'Write {}'.format(certificate_path)
          with open(certificate_path, 'w+') as certificate_file:
              certificate_file.write(
                  OpenSSL.crypto.dump_certificate(FILETYPE_PEM,
                                                  certificate).decode('utf-8')
              )
          helpers.file_rights(certificate_path, mode=0444, uid=0, gid=0)
      else:
          print 'Already exist: {}'.format(certificate_path)
  
      clean_links()
      make_links(common_name)