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

def _tmp_access_rule(method,
                    ip=None,
                    ttl=None,
                    port=None,
                    direction='in',
                    port_origin='d',
                    ip_origin='d',
                    comment=''):
    '''
    Handles the cmd execution for tempdeny and tempallow commands.
    '''
    if _status_csf():
        if ip is None:
            return {'error': 'You must supply an ip address or CIDR.'}
        if ttl is None:
            return {'error': 'You must supply a ttl.'}
        args = _build_tmp_access_args(method, ip, ttl, port, direction, comment)
        return __csf_cmd(args)