Returns a datetime.datetime object

def _get_expiration_date(cert):
    '''
    Returns a datetime.datetime object
    '''
    cert_obj = _read_cert(cert)

    if cert_obj is None:
        raise CommandExecutionError(
            'Failed to read cert from {0}, see log for details'.format(cert)
        )

    return datetime.strptime(
        salt.utils.stringutils.to_str(cert_obj.get_notAfter()),
        four_digit_year_fmt
    )