code: def sample_records(data: Mapping, sample_size: int) -> dict:
      keys = data.keys()
      if len(data) > sample_size:
          keys = random.sample(tuple(keys), sample_size)  # type: ignore[assignment]
      # Always make a copy to avoid surprises
      return {k: data[k] for k in keys}
  
imports: from __future__ import annotations
  import logging
  import random
  from abc import ABC, abstractmethod
  from typing import TYPE_CHECKING, overload
  from warnings import warn
  import numpy
  import numpy.typing
  import sklearn.linear_model
  import dedupe.core
  import dedupe.training
label_desc: Use image node_id 2 for calling a global function with example usage: sample_records(data, sample_size) and returns: unknown