def writeSeg(BCFILE, title, segID, planeNodeIDs):
    """write face segments to BC input file

    Args:
      BCFILE: file IO object
      title (str): header comment line
      segID (int): segment ID #
      planeNodeIDs (int): 2D array

    Returns:
      segID (inc +1)

    """
    BCFILE.write('*SET_SEGMENT_TITLE\n')
    BCFILE.write('%s\n' % title)
    BCFILE.write('%i\n' % segID)
    for i in range(0, (len(planeNodeIDs) - 1)):
        (a, b) = planeNodeIDs.shape
        for j in range(0, (b - 1)):
            BCFILE.write("%i,%i,%i,%i\n" % (planeNodeIDs[i, j],
                                            planeNodeIDs[i + 1, j],
                                            planeNodeIDs[i + 1, j + 1],
                                            planeNodeIDs[i, j + 1]))
    segID = segID + 1

    return segID