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

def _check_unmask(name, unmask, unmask_runtime, root=None):
    '''
    Common code for conditionally removing masks before making changes to a
    service's state.
    '''
    if unmask:
        unmask_(name, runtime=False, root=root)
    if unmask_runtime:
        unmask_(name, runtime=True, root=root)