<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_length_block(fp, writer, fmt='I', padding=1, **kwargs):
 """ Writes a block of data with a length marker at the beginning. Example:: with io.BytesIO() as fp: write_length_block(fp, lambda f: f.write(b'\x00\x00')) :param fp: file-like :param writer: function object that takes file-like object as an argument :param fmt: format of the length marker :param padding: divisor for padding not included in length marker :return: written byte size """

    length_position = reserve_position(fp, fmt)
    written = writer(fp, **kwargs)
    written += write_position(fp, length_position, written, fmt)
    written += write_padding(fp, written, padding)
    return written