def read_xds_correct_lp(correct_lp_file):
    """Read the XDS CORRECT.LP file and get out the spacegroup and
    unit cell constants it decided on."""
    unit_cell = None
    space_group_number = None
    with open(correct_lp_file, 'r') as fh:
        for record in fh.readlines():
            if 'SPACE_GROUP_NUMBER=' in record:
                try:
                    space_group_number = int(record.split()[-1])
                except Exception:
                    space_group_number = 0
            if 'UNIT_CELL_CONSTANTS=' in record and 'used' not in record:
                unit_cell = tuple(map(float, record.split()[-6:]))
    return unit_cell, space_group_number
