def _format_and_kws(fmt):
    """
    >>> _format_and_kws("fmt")
    ('fmt', {})
    >>> _format_and_kws("fmt:+a")
    ('fmt', {'a': True})
    >>> _format_and_kws("fmt:a")
    ('fmt', {'a': True})
    >>> _format_and_kws("fmt:+a,-b") #doctest: +SKIP
    ('fmt', {'a': True, 'b': False})
    >>> _format_and_kws("fmt:c=d")
    ('fmt', {'c': 'd'})
    """
    fmt, kws = fmt, {}
    if fmt and ':' in fmt:
        fmt, kwrepr = fmt.split(':')
        for kw in kwrepr.split(','):
            if '=' in kw:
                k, v = kw.split('=')
                kws[k] = v
            elif kw.startswith('-'):
                kws[kw[1:]] = False
            elif kw.startswith('+'):
                kws[kw[1:]] = True
            else: # same as "+"
                kws[kw] = True
    return fmt, kws