<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_assignment_by_name(self, assignment_name, assignments=None):
 """Get assignment by name. Get an assignment by name. It works by retrieving all assignments and returning the first assignment with a matching name. If the optional parameter ``assignments`` is provided, it uses this collection rather than retrieving all assignments from the service. Args: assignment_name (str):
 name of assignment assignments (list):
 assignments to search, default: None When ``assignments`` is unspecified, all assignments are retrieved from the service. Raises: requests.RequestException: Exception connection error ValueError: Unable to decode response content Returns: tuple: tuple of assignment id and assignment dictionary .. code-block:: python ( 16708850, { u'assignmentId': 16708850, u'categoryId': 1293820, u'description': u'', u'dueDate': 1383541200000, u'dueDateString': u'11-04-2013', u'gradebookId': 1293808, u'graderVisible': False, u'gradingSchemeId': 16708851, u'gradingSchemeType': u'NUMERIC', u'isComposite': False, u'isHomework': False, u'maxPointsTotal': 100.0, u'name': u'midterm1', u'shortName': u'mid1', u'userDeleted': False, u'weight': 1.0 } ) """

        if assignments is None:
            assignments = self.get_assignments()
        for assignment in assignments:
            if assignment['name'] == assignment_name:
                return assignment['assignmentId'], assignment
        return None, None