import yaml


def ydump(data, *args, sort_keys=False, **kwargs):
    """
    Create YAML output string for data object. If data is an OrderedDict, original key ordering
    is preserved in internal call to yaml.dump().

    :param data:
    :type data: dict or Bunch

    :param args: Additional args passed on to yaml.dump()

    :param sort_keys: defaults to False
    :type sort_keys: bool

    :param kwargs: Further keyword args are passed on to yaml.dump()

    :return: YAML string representation of data
    :rtype: str
    """

    return yaml.dump(data, *args, sort_keys=sort_keys, **kwargs)