@classmethod
def filter_valid_useropts(cls, useropts):
    """Filter an opts dict to opts only in cls.options_defaults.

        Pass a dictionary of user-supplied options (``useropts``) to
        this method, and get back a dictionary containing only the
        key/value pairs where a key is present in options_defaults.
        """
    outopts = {}
    for opt in list(cls.options_defaults.keys()):
        if opt in useropts:
            outopts[opt] = useropts[opt]
    return outopts
