def argparser(params):
    """For commands that use pagination, mods, and a variable first parameter.

    Returns `(<first param>, page, mod)`.
    The variable parameter *must* come first. Defaults are:
    - `param_1 = None`
    - `page = 1`, any `int` less than 1000
    - `mod = None`, valid mods are `["NM", "HD", "HR", "DT", "FM"]`."""
    param_1 = None
    page = 1
    mod = None
    #try to determine what the mods and pages are, last param to first
    #if we parse something that's clearly not a number or a mod we assume the remainder
    #composes the first parameter
    for index in range(1,len(params)+1):
            if params[-index].upper() in ["NM", "HD", "HR", "DT", "FM"]:
                #fields in mongodb are case-sensitive
                mod = params[-index].upper()
            elif params[-index].isdigit() and int(params[-index])<1000:
                page = int(params[-index])
            else:
                #the remainder is assumed to be the first parameter, at which point we stop
                if index == 1:
                    #slicing from zero doesn't work
                    param_1 = " ".join(params)
                else:
                    param_1 = " ".join(params[:-(index-1)])
                break
    return (param_1, page, mod)