code: def history(self, samples=500, pandas=True, stream="default"):
          
          node = "history" if stream == "default" else "events"
          query = gql('''
          query Run($project: String!, $entity: String!, $name: String!, $samples: Int!) {
              project(name: $project, entityName: $entity) {
                  run(name: $name) { %s(samples: $samples) }
              }
          }
          ''' % node)
  
          response = self._exec(query, samples=samples)
          lines = [json.loads(line)
                   for line in response['project']['run'][node]]
          if pandas:
              pandas = util.get_module("pandas")
              if pandas:
                  lines = pandas.DataFrame.from_records(lines)
              else:
                  print("Unable to load pandas, call history with pandas=False")
          return lines
docs: Return history metrics for a run
  
          Args:
              samples (int, optional): The number of samples to return
              pandas (bool, optional): Return a pandas dataframe
              stream (str, optional): "default" for metrics, "system" for machine metrics