def decompose_field(field):
    from api.base.serializers import (
        HideIfRetraction, HideIfRegistration,
        HideIfDisabled, AllowMissing
    )
    WRAPPER_FIELDS = (HideIfRetraction, HideIfRegistration, HideIfDisabled, AllowMissing)

    while isinstance(field, WRAPPER_FIELDS):
        try:
            field = getattr(field, 'field')
        except __HOLE__:
            break
    return field
dataset/ETHPy150Open CenterForOpenScience/osf.io/api/base/utils.py/decompose_field