from typing import Any
from typing import List


def one_hot(feature: Any, tokens: List[Any]) -> List[int]:
    """One-hot encodes a feature.

    This will one-hot encode the feature, using a specified list of tokens.

    Args:
        feature: The feature value to one-hot encode.
        tokens: A list of tokens to use for encoding.

    Returns:
        A one-hot encoded list.
    """
    return [int(feature == token) for token in tokens]