code: def get_crt_common_name(certificate_path=OLD_CERTIFICATE_PATH):
      '''
          Get CN from certificate
      '''
      try:
          certificate_file = open(certificate_path)
          crt = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
                                                certificate_file.read())
          return crt.get_subject().commonName
      except IOError:
          return Nonf get_crt_common_name(certificate_path=OLD_CERTIFICATE_PATH):
      '''
          Get CN from certificate
      '''
      try:
          certificate_file = open(certificate_path)
          crt = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM,
                                                certificate_file.read())
          return crt.get_subject().commonName
      except IOError:
          return None
docs: Get CN from certificate