<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def write_file_chunk( file_path: str, packed_chunk: str, append: bool = True, offset: int = -1 ):
 """ Write or append the specified chunk data to the given file path, unpacking the chunk before writing. If the file does not yet exist, it will be created. Set the append argument to False if you do not want the chunk to be appended to an existing file. :param file_path: The file where the chunk will be written or appended :param packed_chunk: The packed chunk data to write to the file. It will be unpacked before the file is written. :param append: Whether or not the chunk should be appended to the existing file. If False the chunk data will overwrite the existing file. :param offset: The byte offset in the file where the chunk should be written. If the value is less than zero, the chunk will be written or appended based on the `append` argument. Note that if you indicate an append write mode and an offset, the mode will be forced to write instead of append. """

    mode = 'ab' if append else 'wb'
    contents = unpack_chunk(packed_chunk)
    writer.write_file(file_path, contents, mode=mode, offset=offset)