from typing import Union
from typing import List
from typing import Dict


def get_samples_by_organism(
    obj: Union[List[str], Dict[str, List[str]], str], default_organism: str
) -> Dict[str, List[str]]:
    """Return the samples in a dict.

    Create a organism-samples dict.

    Args:
        obj: the samples that are collected.
        default_organism: when `obj` is not a dict, `default_organism`
                          is used as key for the output dict.
    Returns:
        A dictionary that maps organisms to lists of samples. If `obj`
        is a dict, a copy of `obj` is returned. If `obj` is a list,
        a dict with `default_organism` that maps to `obj` is returned.
        If `obj` is a string, a dict with `default_organism` that maps
        to a list of one element, `obj`, is returned.

    """
    if isinstance(obj, list):
        return {default_organism: obj}
    elif isinstance(obj, dict):
        return dict(obj)
    else:
        return {default_organism: [obj]}