def __init__(self, file_path=None, xmin=<NUM_LIT:0>, xmax=None, codec='<STR_LIT:utf-8>'):
self.tiers = []<EOL>self.codec = codec<EOL>if not file_path:<EOL><INDENT>if xmax is None:<EOL><INDENT>raise Exception('<STR_LIT>')<EOL><DEDENT>self.tier_num = <NUM_LIT:0><EOL>self.xmin = xmin<EOL>self.xmax = xmax<EOL><DEDENT>else:<EOL><INDENT>with open(file_path, '<STR_LIT:rb>') as f:<EOL><INDENT>self.from_file(f, codec)<EOL><DEDENT><DEDENT>
Construct either a new TextGrid object or read one from a
        file/stream. When you create an empty TextGrid you must at least
        specify the xmax. When you want to load a TextGrid from file you need
        to specify at least the file_path and optionally the codec. Binary,
        short and normal TextGrids are supported.

        :param str file_path: Path to read from, - for stdin. If ``None`` an
                              empty TextGrid will be created.
        :param int xmin: Xmin value, only needed when not loading from file.
        :param int xmax: Xmax value, needed when not loading from file.
        :param str codec: Text encoding for the input. Note that this will be
            ignored for binary TextGrids.
        :raises Exception: If filepath is not specified but no xmax