def integrate_hkl_to_unit_cell(integrate_hkl):
    """Generate a cctbx unit_cell from an integrate_hkl file."""
    from cctbx.uctbx import unit_cell
    for record in open(integrate_hkl):
        if not record.startswith('!'):
            break
        if record.startswith('!UNIT_CELL_CONSTANTS='):
            return unit_cell(tuple(map(float, record.split()[-6:])))
    raise RuntimeError('unit cell not found')
