def _getDMSFields(decDeg, nFields=3, precision=1):
    """Return a string representation of dms fields for decDeg.

    Inputs:
    - decDeg: value in decimal degrees or hours
    - nFields: number of fields; must be >= 1 (and >3 is probably never used)
    - precision: number of digits after the decimal point in the last field;
        if 0, no decimal point is printed; must be >= 0
     
    Returns:
    - signStr: "" or "-"
    - fieldStrs: string value of each field (all positive)
    
    To compute dms a a string, use: signStr + ":".join(fieldStrs)
    This routine doesn't take that step to allow omitting fields
    whose value is zero (e.g. see dmsStrFromDeg and dmsStrFromSec).
    
    Error conditions:
    - Raises ValueError if precision < 0
    """
    if nFields < 1:
        raise ValueError('nFields=%r; must be >= 1' % (nFields,))
    if precision < 0:
        raise ValueError('precision=%r; must be >= 0' % (precision,))
    if decDeg < 0:
        signStr = '-'
    else:
        signStr = ''
    if nFields == 1:
        retNum = round(abs(decDeg), precision)
        retStr = '%.*f' % (precision, retNum)
        return signStr, [retStr]
    remVal = abs(decDeg)
    fieldNums = []
    for fieldNum in range(nFields - 1):
        intVal, remVal = divmod(abs(remVal), 1.0)
        intVal = int(intVal)
        fieldNums.append(intVal)
        remVal *= 60.0
    fieldNums.append(round(remVal, precision))
    incrPrevField = False
    for ind in range(nFields - 1, -1, -1):
        if incrPrevField:
            fieldNums[ind] += 1
        if ind > 0 and fieldNums[ind] >= 60:
            fieldNums[ind] -= 60
            incrPrevField = True
        else:
            incrPrevField = False
    if precision > 0:
        minFloatWidth = precision + 3
    else:
        minFloatWidth = 2
    fieldStrs = ['%d' % (fieldNums[0],)]
    for numVal in fieldNums[1:-1]:
        fieldStrs.append('%02d' % (numVal,))
    fieldStrs.append('%0*.*f' % (minFloatWidth, precision, fieldNums[-1]))
    return signStr, fieldStrs
