code: def ls(self, **kwargs):
      self.snapshot_controller = SnapshotController()
      detailed_info = kwargs.get("details", None)
      show_all = kwargs.get("show_all", None)
      print_format = kwargs.get("format", "table")
      download = kwargs.get("download", None)
      download_path = kwargs.get("download_path", None)
      current_snapshot_obj = self.snapshot_controller.current_snapshot()
      current_snapshot_id = (
          current_snapshot_obj.id if current_snapshot_obj else None
      )
      if show_all:
          snapshot_objs = self.snapshot_controller.list(
              sort_key="created_at", sort_order="descending"
          )
      else:
          snapshot_objs = self.snapshot_controller.list(
              visible=True,
              sort_key="created_at",
              sort_order="descending",
          )
      item_dict_list = []
      if detailed_info:
          header_list = [
              "id",
              "created at",
              "config",
              "stats",
              "message",
              "label",
              "code id",
              "environment id",
              "file collection id",
          ]
          for snapshot_obj in snapshot_objs:
              snapshot_dict_printable = snapshot_obj.to_dictionary(
                  stringify=True
              )
              printable_snapshot_id = (
                  snapshot_dict_printable["id"]
                  if current_snapshot_id is not None
                  and snapshot_dict_printable["id"]
                  != current_snapshot_id
                  else "(current) " + snapshot_dict_printable["id"]
              )
              item_dict_list.append(
                  {
                      "id": printable_snapshot_id,
                      "created at": snapshot_dict_printable[
                          "created_at"
                      ],
                      "config": snapshot_dict_printable["config"],
                      "stats": snapshot_dict_printable["stats"],
                      "message": snapshot_dict_printable["message"],
                      "label": snapshot_dict_printable["label"],
                      "code id": snapshot_obj.code_id,
                      "environment id": snapshot_obj.environment_id,
                      "file collection id": snapshot_obj.file_collection_id,
                  }
              )
      else:
          header_list = [
              "id",
              "created at",
              "config",
              "stats",
              "message",
              "label",
          ]
          for snapshot_obj in snapshot_objs:
              snapshot_dict_printable = snapshot_obj.to_dictionary(
                  stringify=True
              )
              printable_snapshot_id = (
                  snapshot_dict_printable["id"]
                  if current_snapshot_id is not None
                  and snapshot_dict_printable["id"]
                  != current_snapshot_id
                  else "(current) " + snapshot_dict_printable["id"]
              )
              item_dict_list.append(
                  {
                      "id": printable_snapshot_id,
                      "created at": snapshot_dict_printable[
                          "created_at"
                      ],
                      "config": snapshot_dict_printable["config"],
                      "stats": snapshot_dict_printable["stats"],
                      "message": snapshot_dict_printable["message"],
                      "label": snapshot_dict_printable["label"],
                  }
              )
      if download:
          if not download_path:
              # download to current working directory with timestamp
              current_time = datetime.utcnow()
              epoch_time = datetime.utcfromtimestamp(0)
              current_time_unix_time_ms = (
                  current_time - epoch_time
              ).total_seconds() * 1000.0
              download_path = os.path.join(
                  self.snapshot_controller.home,
                  "snapshot_ls_" + str(current_time_unix_time_ms),
              )
          self.cli_helper.print_items(
              header_list,
              item_dict_list,
              print_format=print_format,
              output_path=download_path,
          )
          return snapshot_objs
      self.cli_helper.print_items(
          header_list, item_dict_list, print_format=print_format
      )
      return snapshot_objs
  
imports: from __future__ import print_function
  import os
  from datetime import datetime
  from datmo.core.util.i18n import get
  from datmo.cli.driver.helper import Helper
  from datmo.core.util.misc_functions import mutually_exclusive, printable_object, prettify_datetime, parse_cli_key_value, format_table
  from datmo.core.util.exceptions import SnapshotCreateFromTaskArgs
  from datmo.cli.command.project import ProjectCommand
  from datmo.core.controller.snapshot import SnapshotController
label_desc: Use image node_id 7 for calling the SnapshotCommand obj's underlying member method code with example usage: obj.ls() and returns: snapshot_objs, snapshot_objs