def configure_bound(self, surface_size):
r = len(self.rows)<EOL>max_length = self.max_length<EOL>if self.key_size is None:<EOL><INDENT>self.key_size = (surface_size[<NUM_LIT:0>] - (self.padding * (max_length + <NUM_LIT:1>))) / max_length<EOL><DEDENT>height = self.key_size * r + self.padding * (r + <NUM_LIT:1>)<EOL>if height >= surface_size[<NUM_LIT:1>] / <NUM_LIT:2>:<EOL><INDENT>logger.warning('<STR_LIT>')<EOL>self.key_size = ((surface_size[<NUM_LIT:1>] / <NUM_LIT:2>) - (self.padding * (r + <NUM_LIT:1>))) / r<EOL>height = self.key_size * r + self.padding * (r + <NUM_LIT:1>)<EOL>logger.warning('<STR_LIT>' % self.key_size)<EOL><DEDENT>self.set_size((surface_size[<NUM_LIT:0>], height), surface_size)<EOL>
Compute keyboard bound regarding of this layout.

        If key_size is None, then it will compute it regarding of the given surface_size.

        :param surface_size: Size of the surface this layout will be rendered on.
        :raise ValueError: If the layout model is empty.