def METHOD_NAME(f):
    """Convert forward declaration to a dictionary.
    A returned dictionary will be dumped to JSON while rendering widget.
    """
    if isinstance(f, str):
        return forward.Field(f).to_dict()
    elif isinstance(f, forward.Forward):
        return f.to_dict()
    else:
        raise TypeError("Cannot use {} as forwarded value".format(f))