def new_host_state(self, host, node, capabilities=None, service=None):
 if (capabilities is None):
  capabilities = {}
 cap = capabilities.get('compute', {})
 if bool(cap.get('baremetal_driver')):
  return BaremetalNodeState(host, node, capabilities, service)
 else:
  return host_manager.HostState(host, node, capabilities, service)

def new_host_state ( self , host , node , capabilities = None , service = None ) : if ( capabilities is None ) : capabilities = { } cap = capabilities . get ( 'compute' , { } ) if bool ( cap . get ( 'baremetal_driver' ) ) : return BaremetalNodeState ( host , node , capabilities , service ) else : return host_manager . HostState ( host , node , capabilities , service )
returns an instance of baremetalhoststate or hoststate according to capabilities .