def METHOD_NAME(instance, field_name, subfield=None, secret_key=None):
    """
    Return content of the given instance and field name decrypted.
    """
    try:
        value = instance.inputs[field_name]
    except (TypeError, AttributeError):
        value = getattr(instance, field_name)
    except KeyError:
        raise AttributeError(field_name)
    if isinstance(value, dict) and subfield is not None:
        value = value[subfield]
    value = smart_str(value)
    if not value or not value.startswith('$encrypted$'):
        return value
    key = get_encryption_key(field_name, getattr(instance, 'pk', None), secret_key=secret_key)
    try:
        return smart_str(decrypt_value(key, value))
    except InvalidToken:
        logger.exception(
            "Failed to decrypt `%s(pk=%s).%s`; if you've recently restored from "
            "a database backup or are running in a clustered environment, "
            "check that your `SECRET_KEY` value is correct",
            instance.__class__.__name__,
            getattr(instance, 'pk', None),
            field_name,
            exc_info=True,
        )
        raise