'Create a new node. By default this call creates a persistent znode.
You can also create an ephemeral or a sequential znode.'

def create(self, path, data=None, sequence=False, ephemeral=False):

    ri = path.rindex('/')
    (head, name) = (path[:(ri + 1)], path[(ri + 1):])
    if (head != '/'):
        head = head[:(-1)]
    flags = {'null': ('true' if (data is None) else 'false'), 'ephemeral': ('true' if ephemeral else 'false'), 'sequence': ('true' if sequence else 'false')}
    if ephemeral:
        if self._session:
            flags['session'] = self._session
        else:
            raise ZooKeeper.Error, 'You    need    a    session    to    create    an    ephemeral    node'
    flags = urllib.urlencode(flags)
    url = ('%s/znodes/v1%s?op=create&name=%s&%s' % (self._base, head, name, flags))
    return self._do_post(url, data)
