def _get_num_coefficients(function_dict):
    """
    Returns the number of coeffecients according to the IRAF fits format defined
    here: http://iraf.net/irafdocs/specwcs.php
    """
    function_type = function_dict["type"]

    if function_type in ["legendre", "chebyshev"]:
        return function_dict["order"]
    elif function_type == "linearspline":
        return function_dict["npieces"] + 1
    elif function_type == "cubicspline":
        return function_dict["npieces"] + 3
    else:
        return 0