def maybe_unroll_group(g):
 try:
  size = len(g.tasks)
 except TypeError:
  try:
   size = g.tasks.__length_hint__()
  except (AttributeError, TypeError):
   return g
  else:
   return (list(g.tasks)[0] if (size == 1) else g)
 else:
  return (g.tasks[0] if (size == 1) else g)

def maybe_unroll_group ( g ) : try : size = len ( g . tasks ) except TypeError : try : size = g . tasks . __length_hint__ ( ) except ( AttributeError , TypeError ) : return g else : return ( list ( g . tasks ) [ 0 ] if ( size == 1 ) else g ) else : return ( g . tasks [ 0 ] if ( size == 1 ) else g )
unroll group with only one member .