def METHOD_NAME(self, length: int, encoding: str = "utf8"):
    string = self.bytes[self.current_index: self.current_index + length]
    self.current_index += length
    try:
        encoded_string = string.decode(encoding, "ignore")
    except UnicodeEncodeError:
        raise UnicodeEncodeError
    return encoded_string