def is_flat_space(space):
 if isinstance(space, CompositeSpace):
  for sub_space in space.components:
   if isinstance(sub_space, CompositeSpace):
    return False
 elif (not isinstance(space, Space)):
  raise TypeError(('space is not a Space: %s (%s)' % (space, type(space))))
 return True

def is_flat_space ( space ) : if isinstance ( space , CompositeSpace ) : for sub_space in space . components : if isinstance ( sub_space , CompositeSpace ) : return False elif ( not isinstance ( space , Space ) ) : raise TypeError ( ( 'space is not a Space: %s (%s)' % ( space , type ( space ) ) ) ) return True
returns true for elementary spaces and non-nested compositespaces parameters space : writeme returns writeme .