code: def get_device_index_based_on_prompt(self, prompt):
          
          conn_info = ""
          for device in self.devices:
              conn_info += str(device) + "->"
              if device.prompt == prompt:
                  self.connection.log("Connected: {}".format(conn_info))
                  return self.devices.index(device)
          else:
              return None
docs: Return the device index in the chain based on prompt.