# Path: brewery/utils.py
# def get_logger():
#     """Get brewery default logger"""
#     global logger
#     
#     if logger:
#         return logger
#     else:
#         return create_logger()


from collections import OrderedDict
from brewery.utils import get_logger
            raise Exception("There are more references to the same node")
        else: # if len(names) == 0
            raise Exception("Can not find node '%s'" % node)

    def node(self, name):
        """Return node with name `name`."""
        return self.nodes[name]

    def rename_node(self, node, name):
        """Sets a name for `node`. Raises an exception if the `node` is not
        part of the stream, if `name` is empty or there is already node with
        the same name. """

        if not name:
            raise ValueError("No node name provided for rename")
        if name in self.nodes():
            raise ValueError("Node with name '%s' already exists" % name)

        old_name = self.node_name(node)

        del self.nodes[old_name]
        self.nodes[name] = node

    def coalesce_node(self, reference):
        """Coalesce node reference: `reference` should be either a node name
        or a node. Returns the node object."""

        if isinstance(reference, basestring):
            return self.nodes[reference]
        elif reference in self.nodes.values():

# Path: brewery/utils.py
# def get_logger():
#     """Get brewery default logger"""
#     global logger
#     
#     if logger:
#         return logger
#     else:
#         return create_logger()


# Path: brewery/graph.py
from collections import OrderedDict
from brewery.utils import get_logger

            raise Exception("There are more references to the same node")
        else: # if len(names) == 0
            raise Exception("Can not find node '%s'" % node)

    def node(self, name):
        """Return node with name `name`."""
        return self.nodes[name]

    def rename_node(self, node, name):
        """Sets a name for `node`. Raises an exception if the `node` is not
        part of the stream, if `name` is empty or there is already node with
        the same name. """

        if not name:
            raise ValueError("No node name provided for rename")
        if name in self.nodes():
            raise ValueError("Node with name '%s' already exists" % name)

        old_name = self.node_name(node)

        del self.nodes[old_name]
        self.nodes[name] = node

    def coalesce_node(self, reference):
        """Coalesce node reference: `reference` should be either a node name
        or a node. Returns the node object."""

        if isinstance(reference, basestring):
            return self.nodes[reference]
        elif reference in self.nodes.values():

            return reference