<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def localize_sources(gta, **kwargs):
 """Relocalize sources in the region of interest Parameters gta : `fermipy.gtaanalysis.GTAnalysis` The analysis object kwargs : These are passed to the gta.localize function """

    # Localize all point sources
    for src in sorted(gta.roi.sources, key=lambda t: t['ts'], reverse=True):
        #    for s in gta.roi.sources:
        
        if not src['SpatialModel'] == 'PointSource':
            continue
        if src['offset_roi_edge'] > -0.1:
            continue
        
        gta.localize(src.name, **kwargs)

    gta.optimize()
    gta.print_roi()