<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_wts_get_npred_wt(gta, maskname):
 """Set a weights file and get the weighted npred for all the sources Parameters gta : `fermipy.GTAnalysis` The analysis object maskname : str The path to the file with the mask Returns ------- odict : dict Dictionary mapping from source name to weighted npred """

    if is_null(maskname):
        maskname = None

    gta.set_weights_map(maskname)
    for name in gta.like.sourceNames():
        gta._init_source(name)
    gta._update_roi()
    return build_srcdict(gta, 'npred_wt')