def form_filename(root, meta):
    """
    Form file name from meta data
    """

    plate = str(meta["PLATE"])
    mjd = str(meta["MJD"])
    fiber = meta["FIBERID"]
    if fiber < 10:
        fiber = "000" + str(fiber)
    else:
        if fiber < 100:
            fiber = "00" + str(fiber)
        else:
            if fiber < 1000:
                fiber = "0" + str(fiber)
            else:
                fiber = str(fiber)
    # root+'sas/dr12/boss/spectro/redux/v5_7_0/spectra/lite/'+ # old

    return root + "/" + plate + "/spec-" + plate + "-" + mjd + "-" + fiber + ".fits"