<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def check_encoding_chars(encoding_chars):
 """ Validate the given encoding chars :type encoding_chars: ``dict`` :param encoding_chars: the encoding chars (see :func:`hl7apy.set_default_encoding_chars`) :raises: :exc:`hl7apy.exceptions.InvalidEncodingChars` if the given encoding chars are not valid """

    if not isinstance(encoding_chars, collections.MutableMapping):
        raise InvalidEncodingChars
    required = {'FIELD', 'COMPONENT', 'SUBCOMPONENT', 'REPETITION', 'ESCAPE'}
    missing = required - set(encoding_chars.keys())
    if missing:
        raise InvalidEncodingChars('Missing required encoding chars')

    values = [v for k, v in encoding_chars.items() if k in required]
    if len(values) > len(set(values)):
        raise InvalidEncodingChars('Found duplicate encoding chars')