code: def safe_makedirs(path, uid=-1, gid=-1):
      
      try:
          os.makedirs(path)
      except OSError as e:
          if e.errno == errno.EEXIST:
              pass
          else:
              raise
      else:
          os.chown(path, uid, gid)
docs: create path recursively if it doesn't exist