'Validates that the string compiles as a Python callable.
Args:
value: String to compile as a regular expression.
key: The YAML field name.
Returns:
Value wrapped in an object with properties \'value\' and \'fn\'.
Raises:
InvalidCodeInConfiguration when value does not compile.'

def Validate(self, value, key):

    if isinstance(value, self.ParsedMethod):
        return value
    else:
        return self.ParsedMethod(value, key)
