<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def read_fcs_header_segment(buf, begin=0):
 """ Read HEADER segment of FCS file. Parameters buf : file-like object Buffer containing data to interpret as HEADER segment. begin : int Offset (in bytes) to first byte of HEADER segment in `buf`. Returns ------- header : namedtuple Version information and byte offset values of other FCS segments (see FCS standards for more information) in the following order: - version : str - text_begin : int - text_end : int - data_begin : int - data_end : int - analysis_begin : int - analysis_end : int Notes ----- Blank ANALYSIS segment offsets are converted to zeros. OTHER segment offsets are ignored (see [1]_, [2]_, and [3]_). References .. [1] P.N. Dean, C.B. Bagwell, T. Lindmo, R.F. Murphy, G.C. Salzman, "Data file standard for flow cytometry. Data File Standards Committee of the Society for Analytical Cytology," Cytometry vol 11, pp 323-332, 1990, PMID 2340769. .. [2] L.C. Seamer, C.B. Bagwell, L. Barden, D. Redelman, G.C. Salzman, J.C. Wood, R.F. Murphy, "Proposed new data file standard for flow cytometry, version FCS 3.0," Cytometry vol 28, pp 118-122, 1997, PMID 9181300. .. [3] J. Spidlen, et al, "Data File Standard for Flow Cytometry, version FCS 3.1," Cytometry A vol 77A, pp 97-100, 2009, PMID 19937951. """

    fields = [
        'version',
        'text_begin',
        'text_end',
        'data_begin',
        'data_end',
        'analysis_begin',
        'analysis_end']

    FCSHeader = collections.namedtuple('FCSHeader', fields)

    field_values = []

    buf.seek(begin)
    field_values.append(buf.read(10).decode(encoding).rstrip()) # version

    field_values.append(int(buf.read(8)))                       # text_begin
    field_values.append(int(buf.read(8)))                       # text_end
    field_values.append(int(buf.read(8)))                       # data_begin
    field_values.append(int(buf.read(8)))                       # data_end

    fv = buf.read(8).decode(encoding)                           # analysis_begin
    field_values.append(0 if fv == ' '*8 else int(fv))
    fv = buf.read(8).decode(encoding)                           # analysis_end
    field_values.append(0 if fv == ' '*8 else int(fv))

    header = FCSHeader._make(field_values)
    return header