def has_tasks(dsk, x):
 if istask(x):
  return True
 try:
  if (x in dsk):
   return True
 except:
  pass
 if isinstance(x, list):
  for i in x:
   if has_tasks(dsk, i):
    return True
 return False

def has_tasks ( dsk , x ) : if istask ( x ) : return True try : if ( x in dsk ) : return True except : pass if isinstance ( x , list ) : for i in x : if has_tasks ( dsk , i ) : return True return False
whether x has anything to compute .