# Path: fito/specs/utils.py
# def is_iterable(obj):
#     return isinstance(obj, list) or isinstance(obj, dict) or isinstance(obj, tuple)
# 
# def general_iterator(iterable):
#     if isinstance(iterable, list) or isinstance(iterable, tuple):
#         return enumerate(iterable)
#     elif isinstance(iterable, dict):
#         return iterable.iteritems()
#     else:
#         raise ValueError()


from functools import total_ordering
from fito.specs.utils import is_iterable, general_iterator
import base
    :return:
    """
    if not serialize and default is _no_default:
        raise RuntimeError("If serialize == False, the field should have a default value")

    spec_field_subclass = spec_field_subclass or BaseSpecField

    if base_type is not None:
        assert issubclass(base_type, base.Spec)
        return_type = type(
            'SpecFieldFor{}'.format(base_type.__name__),
            (spec_field_subclass, base_type),
            {}
        )
    else:
        return_type = spec_field_subclass

    return return_type(pos=pos, default=default, base_type=base_type, serialize=serialize)


class SpecCollection(Field, MockIterable):
    """
    Specifies a Field whose value is going to be a collection of specs
    """

    @property
    def allowed_types(self):
        return list, dict, tuple

    def check_valid_value(self, value):

# Path: fito/specs/utils.py
# def is_iterable(obj):
#     return isinstance(obj, list) or isinstance(obj, dict) or isinstance(obj, tuple)
# 
# def general_iterator(iterable):
#     if isinstance(iterable, list) or isinstance(iterable, tuple):
#         return enumerate(iterable)
#     elif isinstance(iterable, dict):
#         return iterable.iteritems()
#     else:
#         raise ValueError()


# Path: fito/specs/fields.py
from functools import total_ordering
from fito.specs.utils import is_iterable, general_iterator
import base

    :return:
    """
    if not serialize and default is _no_default:
        raise RuntimeError("If serialize == False, the field should have a default value")

    spec_field_subclass = spec_field_subclass or BaseSpecField

    if base_type is not None:
        assert issubclass(base_type, base.Spec)
        return_type = type(
            'SpecFieldFor{}'.format(base_type.__name__),
            (spec_field_subclass, base_type),
            {}
        )
    else:
        return_type = spec_field_subclass

    return return_type(pos=pos, default=default, base_type=base_type, serialize=serialize)


class SpecCollection(Field, MockIterable):
    """
    Specifies a Field whose value is going to be a collection of specs
    """

    @property
    def allowed_types(self):
        return list, dict, tuple

    def check_valid_value(self, value):

        if not is_iterable(value): return False