def METHOD_NAME(plot, orientation="normal", tick_gen=None):
    """
    Creates horizontal and vertical gridlines for a plot.  Assumes that the
    index is horizontal and value is vertical by default; set orientation to
    something other than "normal" if they are flipped.
    """
    if orientation in ("normal", "h"):
        v_mapper = plot.index_mapper
        h_mapper = plot.value_mapper
    else:
        v_mapper = plot.value_mapper
        h_mapper = plot.index_mapper
    vgrid = PlotGrid(
        mapper=v_mapper,
        orientation="vertical",
        component=plot,
        line_color="lightgray",
        line_style="dot",
        tick_generator=tick_gen,
    )
    hgrid = PlotGrid(
        mapper=h_mapper,
        orientation="horizontal",
        component=plot,
        line_color="lightgray",
        line_style="dot",
        tick_generator=ScalesTickGenerator(),
    )
    plot.underlays.append(vgrid)
    plot.underlays.append(hgrid)
    return hgrid, vgrid