def make_or_verify_dir(directory, mode=493, uid=0, strict=False):
 try:
  os.makedirs(directory, mode)
 except OSError as exception:
  if (exception.errno == errno.EEXIST):
   if (strict and (not check_permissions(directory, mode, uid))):
    raise errors.Error(('%s exists, but it should be owned by user %d withpermissions %s' % (directory, uid, oct(mode))))
  else:
   raise

def make_or_verify_dir ( directory , mode = 493 , uid = 0 , strict = False ) : try : os . makedirs ( directory , mode ) except OSError as exception : if ( exception . errno == errno . EEXIST ) : if ( strict and ( not check_permissions ( directory , mode , uid ) ) ) : raise errors . Error ( ( '%s exists, but it should be owned by user %d withpermissions %s' % ( directory , uid , oct ( mode ) ) ) ) else : raise
make sure directory exists with proper permissions .