def METHOD_NAME(change_filter=None,
                                 branch=NotABranch, categories=None):
    """
    Static method to create a filter based on constructor args
    change_filter, branch, and categories; use default values @code{None},
    @code{NotABranch}, and @code{None}, respectively.  These arguments are
    interpreted as documented for the
    L{buildbot.schedulers.basic.Scheduler} class.
    @returns: L{ChangeFilter} instance or None for not filtering
    """
    # use a change_filter, if given one
    if change_filter:
        if (branch is not NotABranch or categories is not None):
            raise RuntimeError("cannot specify both change_filter and "
                               "branch or categories")
        return change_filter
    elif branch is not NotABranch or categories:
        # build a change filter from the deprecated category and branch
        # args
        cfargs = {}
        if branch is not NotABranch:
            cfargs['branch'] = branch
        if categories:
            cfargs['category'] = categories
        return ChangeFilter(**cfargs)
    else:
        return None