def maybe_show_tree_param_default(show_tree, name, default):
    """
    Show a function parameter with default for an grammar-tree based on the show_tree flag
    (or file object), writing to the appropriate stream depending on the type
    of the flag.

    :param show_tree: Flag which determines whether the function parameter with
                      default is written to sys.stdout or not. (It is also to
                      pass a file like object, into which the ast will be
                      written).
    :param name:    The function parameter name.
    :param default: The function parameter default.
    """
    if show_tree:
        stream = show_tree if hasattr(show_tree, 'write') else sys.stdout
        stream.write('\n')
        stream.write('--' + name)
        stream.write('\n')
        stream.write(str(default))
        stream.write('\n')
        stream.write('--')
        stream.write('\n')