nodes: 0, module; 1, function_definition; 2, function_name:dump; 3, parameters; 4, block; 5, identifier:obj; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, dictionary_splat_pattern; 10, expression_statement; 11, if_statement; 12, identifier:fp; 13, None; 14, identifier:indent; 15, None; 16, identifier:sort_keys; 17, False; 18, identifier:kw; 19, comment:"""
      Dump object to a file like object or string.
  
      :param obj:
      :param fp: Open file like object
      :param int indent: Indent size, default 2
      :param bool sort_keys: Optionally sort dictionary keys.
      :return: Yaml serialized data.
      """; 20, identifier:fp; 21, block; 22, else_clause; 23, expression_statement; 24, for_statement; 25, block; 26, assignment; 27, identifier:chunk; 28, identifier:iterable; 29, block; 30, return_statement; 31, identifier:iterable; 32, call; 33, expression_statement; 34, call; 35, attribute; 36, argument_list; 37, call; 38, identifier:dumps; 39, argument_list; 40, call; 41, identifier:iterencode; 42, identifier:obj; 43, attribute; 44, argument_list; 45, identifier:obj; 46, keyword_argument; 47, keyword_argument; 48, dictionary_splat; 49, identifier:YAMLEncoder; 50, argument_list; 51, identifier:fp; 52, identifier:write; 53, identifier:chunk; 54, identifier:indent; 55, identifier:indent; 56, identifier:sort_keys; 57, identifier:sort_keys; 58, identifier:kw; 59, keyword_argument; 60, keyword_argument; 61, dictionary_splat; 62, identifier:indent; 63, identifier:indent; 64, identifier:sort_keys; 65, identifier:sort_keys; 66, identifier:kw
code: def dump(obj, fp=None, indent=None, sort_keys=False, **kw):
      """
      Dump object to a file like object or string.
  
      :param obj:
      :param fp: Open file like object
      :param int indent: Indent size, default 2
      :param bool sort_keys: Optionally sort dictionary keys.
      :return: Yaml serialized data.
      """
  
      if fp:
          iterable = YAMLEncoder(indent=indent, sort_keys=sort_keys, **kw).iterencode(obj)
          for chunk in iterable:
              fp.write(chunk)
      else:
          return dumps(obj, indent=indent, sort_keys=sort_keys, **kw)