def parse_serial(pem_certificate):
    """
    Parses a serial number from a PEM-encoded certificate.
    """
    x509_cert = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, pem_certificate)
    x509_cert.get_notAfter()
    parsed_certificate = OpenSSL.crypto.load_certificate(OpenSSL.crypto.FILETYPE_PEM, pem_certificate)
    return parsed_certificate.get_serial_number()

    Parses a serial number from a PEM-encoded certificate.
    
lemur/common/utils.py