<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _maybe_append_chunk(chunk_info, line_index, column, contents, chunks):
 """Append chunk_info to chunks if it is set."""

    if chunk_info:
        chunks.append(_chunk_from_ranges(contents,
                                         chunk_info[0],
                                         chunk_info[1],
                                         line_index,
                                         column))