from typing import Optional
from typing import Tuple
from typing import List
from typing import Any


def ranged_by(limit: Optional[int] = None, offset: Optional[int] = None) -> Tuple[str, List[Any]]:
    """
    Generates ``LIMIT`` and ``OFFSET`` clause using marker.

    :param limit: Limit value. ``None`` means no limitation.
    :param offset: Offset value. ``None`` means ``0`` .
    :returns: Tuple of ``LIMIT`` and ``OFFSET`` clause and parameters.
    """
    clause, params = [], []

    if limit is not None:
        clause.append("LIMIT $_")
        params.append(limit)

    if offset is not None:
        clause.append("OFFSET $_")
        params.append(offset)

    return ' '.join(clause) if clause else '', params