def load_yaml(stream, **kwargs):
<EOL>content = stream.read()<EOL>try:<EOL><INDENT>return yaml.load(content) or {}<EOL><DEDENT>except Exception as e:<EOL><INDENT>if stream.name and stream.name != '<STR_LIT>':<EOL><INDENT>for mark_name in '<STR_LIT>', '<STR_LIT>':<EOL><INDENT>mark = getattr(e, mark_name, None)<EOL>if mark is None:<EOL><INDENT>continue<EOL><DEDENT>if getattr(mark, '<STR_LIT:name>') == '<STR_LIT>':<EOL><INDENT>mark.name = stream.name<EOL><DEDENT><DEDENT><DEDENT>raise e<EOL><DEDENT>
Load yaml-formatted data from a stream.

    Args:
        stream (file-like object).

    Returns:
        dict.