def __init__(self, pattern, flags=0, group=None):
    super(Regex, self).__init__()
    if isinstance(pattern, six.string_types):
        self.regex = re.compile(pattern, flags)
        self.pattern = pattern
    else:
        self.regex = pattern
        self.pattern = pattern.pattern
    self.group = group
def __init__(self, pattern, flags=0, group=None):
    super(Regex, self).__init__()
    if isinstance(pattern, six.string_types):
        self.regex = re.compile(pattern, flags)
        self.pattern = pattern
    else:
        self.regex = pattern
        self.pattern = pattern.pattern
    self.group = group