"""Formatting utilities.""" from decimal import Decimal def to_decimal(value: float | int | str | None) -> Decimal | None: """Safely format a value to decimal.""" if value is None: return value return Decimal(str(value))