def __getitem__(localization, proxy_obj, arguments):
        if type(arguments[0]) is str:
            # string with a concrete value
            if arguments[0] is not str():
                ret = get_contained_elements_type_for_key(
                    get_self(proxy_obj), arguments[0])
                if ret is UndefinedType:
                    ret = get_contained_elements_type_for_key(
                        get_self(proxy_obj), str())
                    if ret is UndefinedType:
                        return StypyTypeError(
                            localization,
                            "No elements exist for the key {0}".format(
                                arguments[0]))
                    else:
                        return ret
                else:
                    return ret
            else:
                # String with an undefined value
                self_obj = get_self(proxy_obj)
                union_ret = None
                for key in self_obj.keys():
                    if key is arguments[0] or type(arguments[0]) is type(key):
                        union_ret = union_type.UnionType.add(
                            union_ret,
                            get_contained_elements_type_for_key(self_obj, key))

                return union_ret

        ret = get_contained_elements_type_for_key(get_self(proxy_obj),
                                                  arguments[0])
        if ret is UndefinedType:
            return StypyTypeError.key_error(localization, arguments[0])
        return ret
    def __iter__(localization, proxy_obj, arguments):
        iter = StandardWrapper(get_self(proxy_obj).__iter__())
        set_contained_elements_type(
            iter,
            get_contained_elements_type(
                TypeWrapper.get_wrapper_of(get_self(proxy_obj))))

        return iter
    def __iter__(localization, proxy_obj, arguments):
        self_object = get_self(proxy_obj)
        listiterator = iter(self_object)
        wrap = StandardWrapper(listiterator)
        set_contained_elements_type(
            wrap, get_contained_elements_type(get_self(proxy_obj)))

        return wrap
    def itervalues(localization, proxy_obj, arguments):
        ret_type = StandardWrapper(get_self(proxy_obj).itervalues())

        stored_values_type = get_value_types(get_self(proxy_obj))

        if stored_values_type is not None:
            set_contained_elements_type(ret_type, stored_values_type)
        else:
            set_contained_elements_type(ret_type, UndefinedType)

        return ret_type
    def stypy____getattribute__(localization, proxy_obj, arguments):
        param = arguments[0]

        if not param is str():
            return get_member(localization, get_self(proxy_obj), param)
        else:
            members = dir(get_self(proxy_obj))
            ret_type = None
            for member in members:
                member_type = get_member(localization, get_self(proxy_obj), member)
                ret_type = union_type.UnionType.add(ret_type, member_type)
            return ret_type
    def __getitem__(localization, proxy_obj, arguments):
        if compare_type(arguments[0], slice):
            ret_type = get_builtin_python_type_instance(localization, "tuple")

            set_contained_elements_type(
                ret_type,
                get_contained_elements_type(
                    TypeWrapper.get_wrapper_of(get_self(proxy_obj))))

            return ret_type

        return get_contained_elements_type(
            TypeWrapper.get_wrapper_of(get_self(proxy_obj)))
    def stypy____delattr__(localization, proxy_obj, arguments):
        attr_name = arguments[0]

        if attr_name is str():
            Advice(localization,
                   "Called __delattr__ without a value in the member name parameter: the operation cannot be checked")
            return types.NoneType
        try:
            del_member(localization, get_self(proxy_obj), attr_name)
        except Exception as exc:
            return StypyTypeError.member_cannot_be_deleted_error(localization, get_self(proxy_obj), attr_name, str(exc))

        return types.NoneType
    def __getslice__(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, 'list')

        set_contained_elements_type(
            ret_type, get_contained_elements_type(get_self(proxy_obj)))

        return ret_type
    def __getnewargs__(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, "tuple")
        # existing_type = get_contained_elements_type(get_self(proxy_obj))
        set_contained_elements_type(
            ret_type, TypeWrapper.get_wrapper_of(get_self(proxy_obj)))

        return ret_type
    def update(localization, proxy_obj, arguments):
        ret = get_self(proxy_obj)
        param = arguments[0]

        if can_store_keypairs(param):
            keys = get_key_types(param)
            if isinstance(keys, union_type.UnionType):
                keys = keys.types
            else:
                keys = list(keys)
            for key in keys:
                value = get_contained_elements_type_for_key(param, key)
                set_contained_elements_type_for_key(ret, key, value)
        else:
            if param.can_store_elements():
                contents = get_contained_elements_type(param)
                if isinstance(contents, tuple):
                    keys = get_contained_elements_type(contents)
                    values = get_contained_elements_type(contents)
                    for key in keys:
                        set_contained_elements_type_for_key(ret, key, values)
                else:
                    return StypyTypeError.invalid_length_error(
                        localization, "Dictionary 'update' sequence", 1, 2)
            else:
                return StypyTypeError.object_must_be_type_error(
                    localization, "The 'update' method second parameter",
                    "dict or an iterable object")

        return ret
    def __setslice__(localization, proxy_obj, arguments):
        existing_type = get_contained_elements_type(get_self(proxy_obj))
        params = arguments[2]
        if can_store_elements(params):
            new_type = existing_type
            other_type = get_contained_elements_type(params)
            if not isinstance(other_type, collections.Iterable):
                other_type = [other_type]
            for par in other_type:
                new_type = union_type.UnionType.add(new_type, par)
        else:
            new_type = union_type.UnionType.add(existing_type, arguments[2])

        set_contained_elements_type(get_self(proxy_obj), new_type)

        return types.NoneType
    def __add__(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, 'list')

        existing_type = get_contained_elements_type(get_self(proxy_obj))
        params = arguments[0]
        if can_store_elements(params):
            if existing_type is not None:
                if not isinstance(existing_type, union_type.UnionType):
                    new_type = existing_type
                else:
                    new_type = existing_type.duplicate()
            else:
                new_type = None
            other_type = get_contained_elements_type(params)
            if not isinstance(other_type, union_type.UnionType):
                other_type = [other_type]
            else:
                other_type = other_type.types

            for par in other_type:
                new_type = union_type.UnionType.add(new_type, par)
        else:
            new_type = union_type.UnionType.add(existing_type, arguments[0])

        set_contained_elements_type(ret_type, new_type)

        return ret_type
    def __mul__(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, "tuple")
        existing_type = get_contained_elements_type(
            TypeWrapper.get_wrapper_of(get_self(proxy_obj)))
        new_type = existing_type
        set_contained_elements_type(ret_type, new_type)

        return ret_type
    def __mul__(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, 'list')

        existing_type = get_contained_elements_type(get_self(proxy_obj))
        new_type = existing_type.clone()
        set_contained_elements_type(ret_type, new_type)

        return ret_type
    def extend(localization, proxy_obj, arguments):
        existing_type = get_contained_elements_type(get_self(proxy_obj))
        params = arguments[0]
        if can_store_elements(params):
            new_type = existing_type
            other_type = get_contained_elements_type(params)
            if not isinstance(other_type, collections.Iterable):
                other_type = [other_type]
            for par in other_type:
                new_type = union_type.UnionType.add(new_type, par)
        else:
            return StypyTypeError.wrong_parameter_type_error(
                localization, "iterable",
                type(params).__name__)

        set_contained_elements_type(get_self(proxy_obj), new_type)

        return types.NoneType
 def append(localization, callable_, arguments):
     self_instance = get_self(callable_)
     existing_type = get_contained_elements_type(self_instance)
     if existing_type is undefined_type.UndefinedType:
         new_type = arguments[0]
     else:
         new_type = union_type.UnionType.add(existing_type, arguments[0])
     set_contained_elements_type(self_instance, new_type)
     return types.NoneType
    def stypy____setattr__(localization, proxy_obj, arguments):
        attr_name = arguments[0]
        attr_value = arguments[1]

        if attr_name is str():
            Advice(localization,
                   "Called __setattr__ without a value in the member name parameter: the operation cannot be checked")
            return types.NoneType

        return set_member(localization, get_self(proxy_obj), attr_name, attr_value)
    def get(localization, proxy_obj, arguments):
        ret = get_contained_elements_type_for_key(get_self(proxy_obj),
                                                  arguments[0])
        if ret is UndefinedType:
            if len(arguments) > 1:
                return arguments[1]
            else:
                return types.NoneType

        return ret
    def __iter__(localization, proxy_obj, arguments):
        ret_type = StandardWrapper(get_self(proxy_obj).__iter__())

        key_list = get_key_types(get_self(proxy_obj))
        stored_keys_type = None
        if isinstance(key_list, union_type.UnionType):
            key_list = key_list.types
        else:
            key_list = list(key_list)

        for key in key_list:
            stored_keys_type = union_type.UnionType.add(stored_keys_type, key)

        if stored_keys_type is not None:
            set_contained_elements_type(ret_type, stored_keys_type)
        else:
            set_contained_elements_type(ret_type, UndefinedType)

        return ret_type
    def values(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, 'list')

        stored_values_type = get_value_types(get_self(proxy_obj))

        if stored_values_type is not None:
            set_contained_elements_type(ret_type, stored_values_type)
        else:
            set_contained_elements_type(ret_type, UndefinedType)

        return ret_type
    def setdefault(localization, proxy_obj, arguments):
        ret_type = TypeModifiers.get(localization, proxy_obj, arguments)
        if len(arguments) > 1:
            t2 = arguments[1]
        else:
            t2 = types.NoneType

        # Type do not exist
        if is_error(ret_type):
            t1 = arguments[0]
            set_contained_elements_type_for_key(get_self(proxy_obj), t1, t2)
        else:
            if len(arguments) > 1:
                t1 = arguments[0]
                set_contained_elements_type_for_key(get_self(proxy_obj), t1,
                                                    t2)
                t2 = union_type.UnionType.add(ret_type, t2)
            else:
                t2 = ret_type

        return t2
    def keys(localization, proxy_obj, arguments):
        ret_type = get_builtin_python_type_instance(localization, 'list')

        if len(get_self(proxy_obj)) == 0:
            return ret_type

        key_list = get_key_types(get_self(proxy_obj))
        if isinstance(key_list, union_type.UnionType):
            key_list = key_list.types
        else:
            key_list = list(key_list)

        stored_keys_type = None
        for value in key_list:
            stored_keys_type = union_type.UnionType.add(
                stored_keys_type, value)

        if stored_keys_type is not None:
            set_contained_elements_type(ret_type, stored_keys_type)
        else:
            set_contained_elements_type(ret_type, UndefinedType)

        return ret_type
    def iteritems(localization, proxy_obj, arguments):
        ret_type = StandardWrapper(get_self(proxy_obj).iteritems())

        key_types = get_contained_elements_type(
            TypeModifiers.iterkeys(localization, proxy_obj, arguments))
        value_types = get_contained_elements_type(
            TypeModifiers.itervalues(localization, proxy_obj, arguments))

        container_type = get_builtin_python_type_instance(
            localization, "tuple")
        union = union_type.UnionType.add(key_types, value_types)
        set_contained_elements_type(container_type, union)

        set_contained_elements_type(ret_type, container_type)

        return ret_type
 def __setitem__(localization, proxy_obj, arguments):
     set_contained_elements_type_for_key(get_self(proxy_obj), arguments[0],
                                         arguments[1])
     return types.NoneType
 def copy(localization, proxy_obj, arguments):
     return get_self(proxy_obj).copy()
 def pop(localization, proxy_obj, arguments):
     return get_contained_elements_type(get_self(proxy_obj))
 def clear(localization, proxy_obj, arguments):
     return get_self(proxy_obj).clear()
 def __enter__(localization, proxy_obj, arguments):
     return get_self(proxy_obj)
 def pop(localization, proxy_obj, arguments):
     return get_value_types(get_self(proxy_obj))
    def next(localization, proxy_obj, arguments):
        self_object = get_self(proxy_obj)

        return get_contained_elements_type(
            TypeWrapper.get_wrapper_of(self_object))