# Path: chemtrails/conf.py
# USER_SETTINGS = getattr(django_settings, 'CHEMTRAILS', None)
# DEFAULTS = {
#     'ENABLED': True,
#     'MAX_CONNECTION_DEPTH': 1,
#     'NAMED_RELATIONSHIPS': True,
#     'CONNECT_META_NODES': False,
#     'IGNORE_MODELS': [
#         'admin.logentry',
#         'migrations.migration',
#     ],
# }
# class CSettings:
#     def __init__(self, user_settings=None, defaults=None):
#     def __getattr__(self, attr):
#     def user_settings(self):
# def reload_settings(*args, **kwargs):
# 
# Path: chemtrails/utils.py
# def get_model_string(model):
#     """
#     :param model: model
#     :returns: <app_label>.<model_name> string representation for the model
#     """
#     return "{app_label}.{model_name}".format(app_label=model._meta.app_label, model_name=model._meta.model_name)
# 
# def flatten(sequence):
#     """
#     Flatten an arbitrary nested sequence.
#     Example usage:
#       >> my_list = list(flatten(nested_lists))
#     :param sequence: A nested list or tuple.
#     :returns: A generator with all values in a flat structure.
#     """
#     for i in sequence:
#         if isinstance(i, Sequence) and not isinstance(i, (str, bytes)):
#             yield from flatten(i)
#         else:
#             yield i
# 
# def timeit(func):
#     """
#     Decorator which logs the timing of executing a function
#     or method call to DEBUG logger.
#     """
#     @functools.wraps(func)
#     def f(*args, **kwargs):
#         timestamp = time.time()
#         func(*args, **kwargs)
#         logger.debug('function [{0}] executed in {1}s'.format(
#             f.__name__, '%.5f' % (time.time() - timestamp)
#         ))
#     return f


import itertools
import logging
import operator
        import csv
from collections import defaultdict, MutableMapping
from functools import reduce
from django.db import models
from django.db.models import Manager
from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured, ValidationError, ObjectDoesNotExist
from django.contrib.postgres.fields import HStoreField, JSONField, RangeField
from django.utils.translation import ungettext
from neomodel import *
from chemtrails.conf import settings
from chemtrails.utils import get_model_string, flatten, timeit
        from chemtrails.neoutils import __node_cache__
        from chemtrails.conf import settings
        from chemtrails.neoutils.managers import PathManager
        from chemtrails.neoutils import (
            __meta_cache__, __node_cache__,
            get_node_class_for_model, get_meta_node_class_for_model
        )
            from chemtrails.neoutils import get_node_class_for_model
        from chemtrails.neoutils import get_node_for_object
        from chemtrails.neoutils import get_node_for_object
        from chemtrails.neoutils import __meta_cache__
        from chemtrails.neoutils import get_meta_node_for_model

    def full_clean(self, exclude=None, validate_unique=True):
        exclude = exclude or []

        props = self.__properties__
        for key in exclude:
            if key in props:
                del props[key]

        try:
            self.deflate(props, self)

            if validate_unique:
                cls = self.__class__
                unique_props = [attr for attr, prop in self.defined_properties(aliases=False, rels=False).items()
                                if prop not in exclude and prop.unique_index]
                for key in unique_props:
                    value = self.deflate({key: props[key]}, self)[key]
                    node = cls.nodes.get_or_none(**{key: value})

                    # If exists and not this node
                    if node and node.id != getattr(self, 'id', None):
                        raise ValidationError({key, 'already exists'})

        except DeflateError as e:
            raise ValidationError({e.property_name: e.msg})
        except RequiredProperty as e:
            raise ValidationError({e.property_name: 'is required'})

    @timeit

# Path: chemtrails/conf.py
# USER_SETTINGS = getattr(django_settings, 'CHEMTRAILS', None)
# DEFAULTS = {
#     'ENABLED': True,
#     'MAX_CONNECTION_DEPTH': 1,
#     'NAMED_RELATIONSHIPS': True,
#     'CONNECT_META_NODES': False,
#     'IGNORE_MODELS': [
#         'admin.logentry',
#         'migrations.migration',
#     ],
# }
# class CSettings:
#     def __init__(self, user_settings=None, defaults=None):
#     def __getattr__(self, attr):
#     def user_settings(self):
# def reload_settings(*args, **kwargs):
# 
# Path: chemtrails/utils.py
# def get_model_string(model):
#     """
#     :param model: model
#     :returns: <app_label>.<model_name> string representation for the model
#     """
#     return "{app_label}.{model_name}".format(app_label=model._meta.app_label, model_name=model._meta.model_name)
# 
# def flatten(sequence):
#     """
#     Flatten an arbitrary nested sequence.
#     Example usage:
#       >> my_list = list(flatten(nested_lists))
#     :param sequence: A nested list or tuple.
#     :returns: A generator with all values in a flat structure.
#     """
#     for i in sequence:
#         if isinstance(i, Sequence) and not isinstance(i, (str, bytes)):
#             yield from flatten(i)
#         else:
#             yield i
# 
# def timeit(func):
#     """
#     Decorator which logs the timing of executing a function
#     or method call to DEBUG logger.
#     """
#     @functools.wraps(func)
#     def f(*args, **kwargs):
#         timestamp = time.time()
#         func(*args, **kwargs)
#         logger.debug('function [{0}] executed in {1}s'.format(
#             f.__name__, '%.5f' % (time.time() - timestamp)
#         ))
#     return f


# Path: chemtrails/neoutils/core.py
import itertools
import logging
import operator
        import csv
from collections import defaultdict, MutableMapping
from functools import reduce
from django.db import models
from django.db.models import Manager
from django.contrib.contenttypes.fields import GenericRelation, GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured, ValidationError, ObjectDoesNotExist
from django.contrib.postgres.fields import HStoreField, JSONField, RangeField
from django.utils.translation import ungettext
from neomodel import *
from chemtrails.conf import settings
from chemtrails.utils import get_model_string, flatten, timeit
        from chemtrails.neoutils import __node_cache__
        from chemtrails.conf import settings
        from chemtrails.neoutils.managers import PathManager
        from chemtrails.neoutils import (
            __meta_cache__, __node_cache__,
            get_node_class_for_model, get_meta_node_class_for_model
        )
            from chemtrails.neoutils import get_node_class_for_model
        from chemtrails.neoutils import get_node_for_object
        from chemtrails.neoutils import get_node_for_object
        from chemtrails.neoutils import __meta_cache__
        from chemtrails.neoutils import get_meta_node_for_model


    def full_clean(self, exclude=None, validate_unique=True):
        exclude = exclude or []

        props = self.__properties__
        for key in exclude:
            if key in props:
                del props[key]

        try:
            self.deflate(props, self)

            if validate_unique:
                cls = self.__class__
                unique_props = [attr for attr, prop in self.defined_properties(aliases=False, rels=False).items()
                                if prop not in exclude and prop.unique_index]
                for key in unique_props:
                    value = self.deflate({key: props[key]}, self)[key]
                    node = cls.nodes.get_or_none(**{key: value})

                    # If exists and not this node
                    if node and node.id != getattr(self, 'id', None):
                        raise ValidationError({key, 'already exists'})

        except DeflateError as e:
            raise ValidationError({e.property_name: e.msg})
        except RequiredProperty as e:
            raise ValidationError({e.property_name: 'is required'})

    @timeit

    def recursive_connect(self, max_depth=settings.MAX_CONNECTION_DEPTH):