def pattern_input(self, question, message='Invalid entry', pattern='^[a-zA-Z0-9_ ]+$', default='',required=True):
        '''
        Method for input disallowing special characters, with optionally
        specifiable regex pattern and error message.
        '''
        result = ''
        requiredFlag = True

        while (not result and requiredFlag):
            result = input('%s: ' % question)
            if result and pattern and not re.match(pattern, result):
                self.stdout.write(self.style.ERROR(message))
                result = ''
            elif not result and default:
                # Return default for fields with default
                return default
            elif not result and required:
                # Ask again for required fields
                self.stdout.write(self.style.ERROR('Answer is required.'))
            elif not required:
                # No need to re-ask for non-required fields
                requiredFlag = False
        return result
Method for input disallowing special characters, with optionally
        specifiable regex pattern and error message.