def maybe_from_tuple(tup_or_range):
 if isinstance(tup_or_range, tuple):
  return from_tuple(tup_or_range)
 elif isinstance(tup_or_range, range):
  return tup_or_range
 raise ValueError(('maybe_from_tuple expects a tuple or range, got %r: %r' % (type(tup_or_range).__name__, tup_or_range)))

def maybe_from_tuple ( tup_or_range ) : if isinstance ( tup_or_range , tuple ) : return from_tuple ( tup_or_range ) elif isinstance ( tup_or_range , range ) : return tup_or_range raise ValueError ( ( 'maybe_from_tuple expects a tuple or range, got %r: %r' % ( type ( tup_or_range ) . __name__ , tup_or_range ) ) )
convert a tuple into a range but pass ranges through silently .