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

def get_regex(self):
        ''' Generates and returns compound regular expression '''
        regex = ''
        for flag in self.compound:
            if flag == '?' or flag == '*':
                regex += flag
            else:
                regex += '(' + '|'.join(self.flags[flag]) + ')'

        return regex