<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def append(self, val):
 """Append byte string val to buffer If the result exceeds the length of the buffer, behavior depends on whether instance was initialized as strict. In strict mode, a ValueError is raised. In non-strict mode, the buffer is extended as necessary. """

        new_len = self.length + len(val)
        to_add = new_len - len(self.bfr)
        if self.strict and to_add > 0:
            raise ValueError("Cannot resize buffer")
        self.bfr[self.length:new_len] = val
        self.length = new_len