code: def ls(filter=None):
      """List snapshots within a project
  
      The project must be created before this is implemented. You can do that by using
      the following command::
  
          $ datmo init
  
  
      Parameters
      ----------
      filter : str, optional
          a string to use to filter from message and label
          (default is to give all snapshots, unless provided a specific string. eg: best)
  
      Returns
      -------
      list
          returns a list of Snapshot entities (as defined above)
  
      Examples
      --------
      You can use this function within a project repository to list snapshots.
  
      >>> import datmo
      >>> snapshots = datmo.snapshot.ls()
      """
  
      snapshot_controller = SnapshotController()
  
      # add arguments if they are not None
  
      core_snapshot_objs = snapshot_controller.list(
          visible=True, sort_key="created_at", sort_order="descending"
      )
  
      # Filtering Snapshots
      # TODO: move to list function in SnapshotController
      # Add in preliminary snapshots if no filter
      filtered_core_snapshot_objs = [
          core_snapshot_obj
          for core_snapshot_obj in core_snapshot_objs
          if core_snapshot_obj.visible and not filter
      ]
      # If filter is present then use it and only add those that pass filter
      for core_snapshot_obj in core_snapshot_objs:
          if core_snapshot_obj.visible:
              if filter and (
                  (filter in core_snapshot_obj.message)
                  or (
                      core_snapshot_obj.label != None
                      and filter in core_snapshot_obj.label
                  )
              ):
                  filtered_core_snapshot_objs.append(core_snapshot_obj)
  
      # Return Snapshot entities
      return [
          Snapshot(filtered_core_snapshot_obj)
          for filtered_core_snapshot_obj in filtered_core_snapshot_objs
      ]
  
file_path: datmo/datmo/snapshot.py
imports: import os
  from datmo.core.controller.snapshot import SnapshotController
  from datmo.core.entity.snapshot import Snapshot
  from datmo.core.util.exceptions import InvalidArgumentType, SnapshotCreateFromTaskArgs
  from datmo.core.util.misc_functions import prettify_datetime, format_table
label_desc: Use image node_id 2 for calling a global function with example usage: ls(filter) and returns: unknown