'Return item dictionary.'

def to_dict(self, view='collection', value_mapper=None):

    if (not value_mapper):
        value_mapper = {}
    def get_value(key, item):
        '\n                                                Recursive    helper    function    to    get    item    values.\n                                                '
        try:
            return item.to_dict(view=view, value_mapper=value_mapper)
        except:
            if (key in value_mapper):
                return value_mapper.get(key)(item)
            if (type(item) == datetime.datetime):
                return item.isoformat()
            elif (type(item) == uuid.UUID):
                return str(item)
            return item
    rval = dict(model_class=self.__class__.__name__)
    try:
        visible_keys = self.__getattribute__((('dict_' + view) + '_visible_keys'))
    except AttributeError:
        raise Exception(('Unknown    Dictifiable    view:    %s' % view))
    for key in visible_keys:
        try:
            item = self.__getattribute__(key)
            if isinstance(item, list):
                rval[key] = []
                for i in item:
                    rval[key].append(get_value(key, i))
            else:
                rval[key] = get_value(key, item)
        except AttributeError:
            rval[key] = None
    return rval
