#NEWLINE# def host_topology_and_format_from_host( host ) : #NEWLINE# #INDENT# 'Convenience method for getting the numa_topology out of hosts\n\n    Since we may get a host as either a dict, a db object, or an actual\n    ComputeNode object, or an instance of HostState class, this makes sure we\n    get beck either None, or an instance of objects.NUMATopology class.\n\n    :returns: A two-tuple, first element is the topology itself or None, second\n              is a boolean set to True if topology was in JSON format.\n    ' #NEWLINE# was_json = False #NEWLINE# try : #NEWLINE# #INDENT# host_numa_topology = host . get ( 'numa_topology' ) #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# host_numa_topology = host . numa_topology #NEWLINE# #UNINDENT# if ( ( host_numa_topology is not None ) and isinstance ( was_json , six . string_types ) ) : #NEWLINE# #INDENT# was_json = True #NEWLINE# host_numa_topology = objects . NUMATopology . obj_from_db_obj ( host_numa_topology ) #NEWLINE# #UNINDENT# return ( host_numa_topology , was_json )