<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def console_from_file(filename: str) -> tcod.console.Console: """Return a new console object from a filename. The file format is automactially determined. This can load REXPaint `.xp`, ASCII Paint `.apf`, or Non-delimited ASCII `.asc` files. Args: filename (Text):
 The path to the file, as a string. Returns: A new :any`Console` instance. """

    return tcod.console.Console._from_cdata(
        lib.TCOD_console_from_file(filename.encode("utf-8"))
    )