<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def parse_value(val, var_type=None, enums=None, rebase_arrays=True):
 """Parses the value of a dzn statement. Parameters val : str A value in dzn format. var_type : dict The dictionary of variable type as returned by the command ``minizinc --model-types-only``. Default is ``None``, in which case the type of the variable is inferred from its value. To parse an enum value as a Python enum type its ``var_type`` is required, otherwise the value is simply returned as a string. enums : dict of IntEnum A dictionary containing Python enums, with their respective names as keys. These enums are available to the parser to convert enum values into corresponding values of their respective enum types. Enum values can only be parsed if also the ``var_type`` of the variable is available. rebase_arrays : bool If the parsed value is an array and ``rebase_arrays`` is ``True``, return it as zero-based lists. If ``rebase_arrays`` is ``False``, instead, return it as a dictionary, preserving the original index-set. Returns ------- object The parsed object. The type of the object depends on the dzn value. """


    if not var_type:
        p_val = _parse_array(
            val, rebase_arrays=rebase_arrays, enums=enums, raise_errors=False
        )
        if p_val is not None:
            return p_val
        return _parse_val(val, enums=enums)

    if 'dims' in var_type:
        return _parse_array(
            val, rebase_arrays=rebase_arrays, var_type=var_type, enums=enums
        )

    return _parse_val(val, var_type=var_type, enums=enums)