from typing import List
from typing import Any
from typing import Optional
import random


def subsample_list_by_proportion(input_list: List[Any],
                                 proportion: float,
                                 seed: Optional[int] = None) -> List[Any]:
  """Subsample a list based on proportion in [0.0, 1.0].

  Args:
    input_list: The input list to subsample.
    proportion: A floating number indicating the proportion.
    seed: An optional random seed.

  Returns:
    A subsampled list of length round(len(input_list) * proportion).
  """
  if proportion is None or proportion < 0.0 or proportion > 1.0:
    raise ValueError(
        f'proportion must be a floating number in [0.0, 1.0], get {proportion}')

  elements_to_sample = round(len(input_list) * proportion)
  return random.Random(seed).sample(input_list, elements_to_sample)