code: def _collect_rev(
      repo: "Repo",
      rev: str,
      param_deps: bool = False,
      **kwargs,
  ) -> SerializableExp:
      with repo.switch(rev) as rev:
          if rev == "workspace":
              timestamp: Optional[datetime] = None
          else:
              commit = repo.scm.resolve_commit(rev)
              timestamp = datetime.fromtimestamp(commit.commit_time)
  
          return SerializableExp.from_repo(
              repo,
              rev=rev,
              param_deps=param_deps,
              timestamp=timestamp,
          )
  
imports: import itertools
  import os
  from dataclasses import fields
  from datetime import datetime
  from typing import TYPE_CHECKING, Collection, Dict, Iterable, Iterator, List, Optional, Tuple, Union
  from funcy import first
  from scmrepo.exceptions import SCMError
  from dvc.log import logger
  from dvc.scm import Git, SCMError, iter_revs
  from .exceptions import InvalidExpRefError
  from .refs import EXEC_BRANCH, ExpRefInfo
  from .serialize import ExpRange, ExpState, SerializableError, SerializableExp
  from .utils import describe
label_desc: Use image node_id 2 for calling a global function with example usage: _collect_rev(repo, rev, param_deps) and returns: SerializableExp