'Same as os.makedirs - makes a new directory and automatically creates
all parent directories if they do not exist.
mode specifies unix permissions to apply to the new dir'

def makedirs(self, path, mode=493):

    (head, tail) = posixpath.split(path)
    if (not tail):
        (head, tail) = posixpath.split(head)
    if (head and tail and (not self.path_exists(head))):
        try:
            self.makedirs(head, mode)
        except OSError as e:
            if (e.errno != os.errno.EEXIST):
                raise
        if (tail == posixpath.curdir):
            return
    self.mkdir(path, mode)
