from typing import Dict
from typing import OrderedDict


def gather_subtasks(d: Dict) -> OrderedDict:
    """Declare subtasks and log messages in order

    Args:
        d (Dict): a dict-like object mapping subtasks to log messages

    Returns:
        OrderedDict: map tasks to log messages in order of execution
    """
    if not all(isinstance(k, str) for k in d.keys()):
        raise TypeError("Subtasks must be str")
    if not all(isinstance(v, str) for v in d.values() if v is not None):
        raise TypeError("Subtask log messages must be str or NoneType")

    return OrderedDict(**d)