def make_amrcolors(nlevels=4):
    """
    :param nlevels: maximum number of AMR levels expected.

    Make lists of colors useful for distinguishing different grids when
    plotting AMR results.

    Returns the tuple (linecolors, bgcolors):\n
        linecolors = list of nlevels colors for grid lines, contour lines. \n
        bgcolors = list of nlevels pale colors for grid background.

    """

    # For 4 or less levels:
    linecolors = ["k", "b", "r", "g"]
    # Set bgcolors to white, then light shades of blue, red, green:
    bgcolors = ["#ffffff", "#ddddff", "#ffdddd", "#ddffdd"]
    # Set bgcolors to light shades of yellow, blue, red, green:
    # bgcolors = ['#ffffdd','#ddddff','#ffdddd','#ddffdd']

    if nlevels > 4:
        linecolors = 4 * linecolors  # now has length 16
        bgcolors = 4 * bgcolors
    if nlevels <= 16:
        linecolors = linecolors[:nlevels]
        bgcolors = bgcolors[:nlevels]
    else:
        print("*** Warning, suggest nlevels <= 16")

    return linecolors, bgcolors