def _mkdir(newdir):
 if os.path.isdir(newdir):
  pass
 elif os.path.isfile(newdir):
  raise OSError(("a file with the same name as the desired dir, '%s', already exists." % newdir))
 else:
  (head, tail) = os.path.split(newdir)
  if (head and (not os.path.isdir(head))):
   _mkdir(head)
  if tail:
   os.mkdir(newdir)

def _mkdir ( newdir ) : if os . path . isdir ( newdir ) : pass elif os . path . isfile ( newdir ) : raise OSError ( ( "a file with the same name as the desired dir, '%s', already exists." % newdir ) ) else : ( head , tail ) = os . path . split ( newdir ) if ( head and ( not os . path . isdir ( head ) ) ) : _mkdir ( head ) if tail : os . mkdir ( newdir )
works the way a good mkdir should :) - already exists .