_char_assert_template ("char must be single character'{ }"is too long"_max_rows _max_columns _grid [_background_char here we define some private data for internal use by the module we use leading underscores so that if the module is imported using from chargrid import *none of these variables will be imported (an alternative approach would be to set an __all__ list the _char_assert_template is string for use with the str format(functionwe will see it used to give an error message in assert statements we will discuss the other variables as we encounter them if sys platform startswith("win")def clear_screen()subprocess call(["cmd exe""/ ""cls"]elsedef clear_screen()subprocess call(["clear"]clear_screen __doc__ """clears the screen using the underlying window system' clear screen command""the means of clearing the console screen is platform-dependent on windows we must execute the cmd exe program with appropriate arguments and on most unix systems we execute the clear program the subprocess module' subprocess call(function lets us run an external programso we can use it to clear the screen in the appropriate platform-specific way the sys platform string holds the name of the operating system the program is running onfor example"win or "linux so one way of handling the platform differences would be to have single clear_screen(function like thisdef clear_screen()command (["clear"if not sys platform startswith("win"else ["cmd exe""/ ""cls"]subprocess call(commandthe disadvantage of this approach is that even though we know the platform cannot change while the program is runningwe perform the check every time the function is called to avoid checking which platform the program is being run on every time the clear_screen(function is calledwe have created platform-specific clear_screen(function once when the module is importedand from then on we always use it this is possible because the def statement is python statement like any otherwhen the interpreter reaches the if it executes either the first or the second def statementdynamically creating one or the other