Create a YAML object for loading a YAML configuration.

    Args:
        modules_to_register: Modules containing classes to be registered with the YAML object. Default: None.
        classes_to_register: Classes to be registered with the YAML object. Default: None.
    Returns:
        A newly creating YAML object, configured as apporpirate.

def yaml(modules_to_register: Iterable[Any] = None, classes_to_register: Iterable[Any] = None) -> ruamel.yaml.YAML:
    """ Create a YAML object for loading a YAML configuration.

    Args:
        modules_to_register: Modules containing classes to be registered with the YAML object. Default: None.
        classes_to_register: Classes to be registered with the YAML object. Default: None.
    Returns:
        A newly creating YAML object, configured as apporpirate.
    """
    # Defein a round-trip yaml object for us to work with. This object should be imported by other modules
    # NOTE: "typ" is a not a typo. It stands for "type"
    yaml = ruamel.yaml.YAML(typ = "rt")

    # Register representers and constructors
    # Numpy
    yaml.representer.add_representer(np.ndarray, numpy_to_yaml)
    yaml.constructor.add_constructor("!numpy_array", numpy_from_yaml)
    # Register external classes
    yaml = register_module_classes(yaml = yaml, modules = modules_to_register)
    yaml = register_classes(yaml = yaml, classes = classes_to_register)

    return yaml