from typing import Union
from typing import List


def process_dorms(dorms: Union[str, None] = None,
                  size: Union[int, None] = None,
                  default_dorm: str = 'Unknown',
                  dorm_separator: Union[str, None] = None) -> List[List[str]]:
    """Process the dorms.

    Args:
        dorms (Union[List[str], None], optional): Input definition or methods. Default to None.
        size (Union[int, None], optional):
            Size of the dorm array, only used and required when dorms is None. Default to None.
        default_dorm (str, optional):
            Default dorm used when dorms is None.
        dorm_separator (Union[str, None], optional):
            Dorm separator for when multiple definition or methods present.

    Returns:
        List[List[str]]:
            List of list of definition or methods. The second layer of list is for convenience
            when there are multiple definition or methods.
    """
    if dorms is None:
        if size is None:
            raise ValueError("Size cannot be None, when dorms is None.")
        return [[default_dorm]]*size
    else:
        return [dorm.split(dorm_separator) for dorm in dorms]