def channel_dict_kwarg(value, channels, types=None, astype=None):
if types is not None and isinstance(value, tuple(types)):<EOL><INDENT>out = dict((c, value) for c in channels)<EOL><DEDENT>elif isinstance(value, (tuple, list)):<EOL><INDENT>out = dict(zip(channels, value))<EOL><DEDENT>elif value is None:<EOL><INDENT>out = dict()<EOL><DEDENT>elif isinstance(value, dict):<EOL><INDENT>out = value.copy()<EOL><DEDENT>else:<EOL><INDENT>return None<EOL><DEDENT>if astype is not None:<EOL><INDENT>return dict((key, astype(out[key])) for key in out)<EOL><DEDENT>return out<EOL>
Format the given kwarg value in a dict with one value per channel

    Parameters
    ----------
    value : any type
        keyword argument value as given by user

    channels : `list`
        list of channels being read

    types : `list` of `type`
        list of valid object types for value

    astype : `type`
        output type for `dict` values

    Returns
    -------
    dict : `dict`
        `dict` of values, one value per channel key, if parsing is successful
    None : `None`
        `None`, if parsing was unsuccessful