A decorator that defines a field for data within a :class:`DataStruct`

    The decorated function becomes the parser for a :class:`DataField` which
    will be assigned to a data structure under the function's defined name.

    Parameters
    ----------
    path: tuple
        The path to a value within a raw piece of data. If no path is provided
        the path is assumed to be ``(self.this_name)`` where ``self.this_name``
        is that of the attribute this field was defined under.
    **kwargs:
        By explicitely claiming ``path=None``, no assumptions are made about the
        ``path``, causing all the raw data to be passed to the handler for parsing.

def datafield(*path, **kwargs):
    """A decorator that defines a field for data within a :class:`DataStruct`

    The decorated function becomes the parser for a :class:`DataField` which
    will be assigned to a data structure under the function's defined name.

    Parameters
    ----------
    path: tuple
        The path to a value within a raw piece of data. If no path is provided
        the path is assumed to be ``(self.this_name)`` where ``self.this_name``
        is that of the attribute this field was defined under.
    **kwargs:
        By explicitely claiming ``path=None``, no assumptions are made about the
        ``path``, causing all the raw data to be passed to the handler for parsing.
    """
    if len(path) == 1 and isinstance(path[0], types.FunctionType):
        return DataField(**kwargs)(*path)
    else:
        return DataField(*path, **kwargs)