from typing import Any


def format_with_optional_units(value: Any, units: str) -> str:
    """
    Ex:
    > format_with_optional_units(25.0, "cm") # returns "25.0 cm"
    > format_with_optional_units(25.0, None) # returns "25.0"
    """
    if units is None:
        return f"{value}"

    if units == "%":
        return f"{value}{units}"
    else:
        return f"{value} {units}"