def extract_value(obj):
    """This is to handle the extraction from nested vs. flat JSON.

    Args:
        obj (:py:obj): Object that may contain value in a nested or flat way.

    Returns:
        obj (:py:obj): Value extracted from object.
    """
    return obj['value'] if isinstance(obj, dict) and 'value' in obj else obj
