def Property(function):
    """ Property(function)
    
    A property decorator which allows to define fget, fset and fdel
    inside the function.
    
    Note that the class to which this is applied must inherit from object!
    Code based on an example posted by Walker Hale:
    http://code.activestate.com/recipes/410698/#c6
    
    Example
    -------
    
    class Example(object):
        @Property
        def myattr():
            ''' This is the doc string.
            '''
            def fget(self):
                return self._value
            def fset(self, value):
                self._value = value
            def fdel(self):
                del self._value
            return locals()
    
    """
    known_keys = 'fget', 'fset', 'fdel', 'doc'
    func_locals = function()
    if not isinstance(func_locals, dict):
        raise RuntimeError('Property function should "return locals()".')
    D = {'doc': function.__doc__}
    for key in list(func_locals.keys()):
        if key in known_keys:
            D[key] = func_locals[key]
        else:
            raise RuntimeError('Invalid Property element: %s' % key)
    return property(**D)
