@staticmethod
def _list_or_dict_subscript(obj, key):
    """
        Helper function to use key as a key if obj is a dict, or as an int index if list.

        :param obj: The object to subscript.
        :param key: The key to subscript with.
        :return: The subscripted object.
        """
    if isinstance(obj, dict):
        return obj[key]
    elif isinstance(obj, list):
        return obj[int(key)]
    else:
        raise TypeError
