def METHOD_NAME():
    # Set output encoding to UTF-8
    set_output_encoding()
    # Parse input
    output = options["output"]  # done
    style_name = options["style_name"]  # done
    map = options["map"]  # done
    # check if input file exists
    if not grass.find_file(map)["file"]:
        grass.fatal(_("Raster map <%s> not found") % map)
    # Get map metadata
    mapinfo = grass.parse_command("r.info", flags="e", map=map)
    if mapinfo["title"]:
        name = "{}: {}".format(mapinfo["map"], mapinfo["title"])
    else:
        name = mapinfo["map"]
    # Get color rules
    color_rules = grass.read_command("r.colors.out", map=map).split("\n")
    # Get maptype (CELL, FCELL, DCELL)
    maptype = grass.parse_command("r.info", flags="g", map=map)["datatype"]
    # Check if map has categories if type is CELL
    if maptype == "CELL":
        grass.verbose("Reading category lables, may take a while...")
        categories = grass.parse_command("r.category", map=map, separator="=")
        if list(set(categories.values()))[0] or len(list(set(categories.values()))) > 1:
            use_categories = True
        else:
            use_categories = False
    else:
        use_categories = False
    # Initialize SLD with header
    sld = """<?xml version="1.0" encoding="UTF-8"?>