def _is_valid_dimension(dim: Optional[str]) -> bool:
    """
    Utility function to validate if the given dimension is a pixel or percentage value.

    Args:
        dim: The dimension string to validate (e.g., '300px', '50%').

    Returns:
        True if valid, False otherwise.
    """
    if dim is None:
        return True
    return bool(re.match(r"^\d+(px|%)$", dim))

    Utility function to validate if the given dimension is a pixel or percentage value.

    Args:
        dim: The dimension string to validate (e.g., '300px', '50%').

    Returns:
        True if valid, False otherwise.
    
argilla/src/argilla/markdown/media.py