'Factory for Node class'

def get_node(self, node_id, user='root'):

    instances = self.ec2.get_all_instances()
    node = None
    for instance in instances:
        if (instance.dns_name == node_id):
            node = instance
            break
        elif (instance.id == node_id):
            node = instance
            break
    if (not node):
        raise exception.InstanceDoesNotExist(node_id)
    key = self.cfg.get_key(node.key_name)
    node = Node(node, key.key_location, user=user)
    return node
