There is no sense to create a function for a line of code, please remove it:
if not os.path.isdir(path): os.mkdir(path)
or you can use 'makedirs' to create also the parent dirs.
if not os.path.isdir(path): os.makedirs(path)