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

def complete_variable(text):
    '''complete a MAVLink variable'''
    if text.find('.') != -1:
        var = text.split('.')[0]
        if var in rline_mpstate.status.msgs:
            ret = []
            for f in rline_mpstate.status.msgs[var].get_fieldnames():
                ret.append(var + '.' + f)
            return ret
        return []
    return rline_mpstate.status.msgs.keys()