def country(cert):
    """
    Attempt to get the country from a given certificate.
    :param cert:
    :return:
    """
    try:
        c = cert.subject.get_attributes_for_oid(x509.OID_COUNTRY_NAME)
        if not c:
            return None

        return c[0].value.strip()
    except Exception as e:
        capture_exception()
        current_app.logger.error(f"Unable to get country! {e}")

    Attempt to get the country from a given certificate.
    :param cert:
    :return:
    
lemur/common/defaults.py