Service company (4 points) ========================== A service company offers different types of services as maintenance, cleaning, safety, repair, etc. It manages a daily services file with the following data: worker id (:py:class:`str`), service type (:py:class:`str`), shift (:py:class:`str`), arrival time (:py:class:`int`), i. e. time it takes for the worker to get to the place that needs the service, service duration (:py:class:`int`) and a :py:class:`bool` that indicates whether this service was urgent or not. Times are expressed in minutes. Example: .. literalinclude:: servicesC.txt :language: text :lines: 18 - 21, 43-44 Download the following example files, needed for the tests: :download:`servicesA.txt`, :download:`servicesB.txt`, :download:`servicesC.txt`. This company wants to solve the next problems with three Python functions that must be saved to the same file ``service.py``: 1. Classify urgent services by service type (1.5 points). Write function :py:func:`service1` that takes the name of a file (:py:class:`str`) as described, and returns a dictionary (:py:class:`dict`) corresponding to urgent services. The key of the dictionary is the service type and the value is a :py:class:`list` with the arrival times of those services of this type that were urgent. These lists must be in the same order as in the given file. Example: .. literalinclude:: test-service1.txt :language: python :lines: 3 - 7 .. note:: You have more tests in file :download:`test-service1.txt` 2. Obtain the service type with larger average arrival times (1 point). Write function :py:func:`service2` that takes a dictionary (:py:class:`dict`) as the one returned by :py:func:`service1`. This function must compute the average of the arrival times for each service type and must return a :py:class:`tuple` with two elements. The first one is the service type with the maximum computed average of arrival times (:py:class:`str`) and the second one is this maximum average of arrival times (:py:class:`float`). You can consider that this maximum is unique and that the dictionary is not empty. Example: .. literalinclude:: test-service2.txt :language: python :lines: 3 - 10 .. note:: You have more tests in file :download:`test-service2.txt` 3. Obtain a file with data corresponding to a specific service type (1.5 points). Write function :py:func:`service3` that takes the name of a file (:py:class:`str`) as the one described in the first paragraph, and a service type (:py:class:`str`), and creates another file corresponding to the given service type. The name of this file is the name of the service type followed by the extension ``'.txt'``. Each line of this file has three data fields: the worker id, the shift and the total time (arrival plus duration) for this service (:py:class:`int`), separated by a space. Example: .. literalinclude:: test-service3.txt :language: python :lines: 3 - 13 .. note:: You have more tests in file :download:`test-service3.txt` .. hint:: Remember to use functions ``int`` and ``str`` to decode and encode integer values.