<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def layout_filename(fallback):
    '''get location of layout file'''
    global display_size
    global vehiclename
    (dw,dh) = display_size
    if 'HOME' in os.environ:
        dirname = os.path.join(os.environ['HOME'], ".mavproxy")
        if not os.path.exists(dirname):
            try:
                os.mkdir(dirname)
            except Exception:
                pass
    elif 'LOCALAPPDATA' in os.environ:
        dirname = os.path.join(os.environ['LOCALAPPDATA'], "MAVProxy")
    else:
        return None
    if vehiclename:
        fname = os.path.join(dirname, "layout-%s-%ux%u" % (vehiclename,dw,dh))
        if not fallback or os.path.exists(fname):
            return fname
    return os.path.join(dirname, "layout-%ux%u" % (dw,dh))