def _format_color(color):
    """Return color in format usable by 'fill' attribute of SVG shapes."""
    if isinstance(color, str):
        return color

    elif isinstance(color, Iterable):

        _r, _g, _b, *_ = color
        return f'rgb({_r}, {_g}, {_b})'

    elif color is None:
        return 'none'

    else:

        raise TypeError(
            "'color' must be None, string or iterable of integers with 3+ values"
        )
Return color in format usable by 'fill' attribute of SVG shapes.
nodezator/svgutils.py