<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def move_to_pat(pat: str, offset: (float, float)=None, tolerance: int=0) -> None: """See help for click_on_pat"""

    with tempfile.NamedTemporaryFile() as f:
        subprocess.call('''
        xwd -root -silent -display :0 | 
        convert xwd:- png:''' + f.name, shell=True)
        loc = visgrep(f.name, pat, tolerance)
    pat_size = get_png_dim(pat)
    if offset is None:
        x, y = [l + ps//2 for l, ps in zip(loc, pat_size)]
    else:
        x, y = [l + ps*(off/100) for off, l, ps in zip(offset, loc, pat_size)]
    mouse_move(x, y)