<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def assert_legal_arguments(kwargs):
 """Assert that PrettyPrinter arguments are correct. Raises ------ ValueError In case there are unknown arguments or a single layer is mapped to more than one aesthetic. """

    seen_layers = set()
    for k, v in kwargs.items():
        if k not in LEGAL_ARGUMENTS:
            raise ValueError('Illegal argument <{0}>!'.format(k))
        if k in AESTHETICS:
            if v in seen_layers:
                raise ValueError('Layer <{0}> mapped for more than a single aesthetic!'.format(v))
            seen_layers.add(v)
        if k in VALUES:
            if not isinstance(v, six.string_types) and not isinstance(v, list):
                raise ValueError('Value <{0}> must be either string or list'.format(k))
            if isinstance(v, list):
                if len(v) == 0:
                    raise ValueError('Rules cannot be empty list')
                for rule_matcher, rule_value in v:
                    if not isinstance(rule_matcher, six.string_types) or not isinstance(rule_value, six.string_types):
                        raise ValueError('Rule tuple elements must be strings')