<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def expired(certificate):
    '''
    Returns a dict containing limited details of a
    certificate and whether the certificate has expired.

    .. versionadded:: 2016.11.0

    certificate:
        The certificate to be read. Can be a path to a certificate file,
        or a string containing the PEM formatted text of the certificate.

    CLI Example:

    .. code-block:: bash

        salt '*' x509.expired "/etc/pki/mycert.crt"
    '''
    ret = {}

    if os.path.isfile(certificate):
        try:
            ret['path'] = certificate
            cert = _get_certificate_obj(certificate)

            _now = datetime.datetime.utcnow()
            _expiration_date = cert.get_not_after().get_datetime()

            ret['cn'] = _parse_subject(cert.get_subject())['CN']

            if _expiration_date.strftime("%Y-%m-%d %H:%M:%S") <= \
                    _now.strftime("%Y-%m-%d %H:%M:%S"):
                ret['expired'] = True
            else:
                ret['expired'] = False
        except ValueError as err:
            log.debug('Failed to get data of expired certificate: %s', err)
            log.trace(err, exc_info=True)

    return ret