<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_file(filename, use_cores=True, thresh=1.e-4):
 """ Reads an xr-formatted file to create an Xr object. Args: filename (str):
 name of file to read from. use_cores (bool):
 use core positions and discard shell positions if set to True (default). Otherwise, use shell positions and discard core positions. thresh (float):
 relative threshold for consistency check between cell parameters (lengths and angles) from header information and cell vectors, respectively. Returns: xr (Xr):
 Xr object corresponding to the input file. """

        with zopen(filename, "rt") as f:
            return Xr.from_string(
                    f.read(), use_cores=use_cores,
                    thresh=thresh)