<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_students(self, student_emails, nid=None):
 """Enroll students in a network `nid`. Piazza will email these students with instructions to activate their account. :type student_emails: list of str :param student_emails: A listing of email addresses to enroll in the network (or class). This can be a list of length one. :type nid: str :param nid: This is the ID of the network to add students to. This is optional and only to override the existing `network_id` entered when created the class :returns: Python object containing returned data, a list of dicts of user data of all of the users in the network including the ones that were just added. """

        r = self.request(
            method="network.update",
            data={
                "from": "ClassSettingsPage",
                "add_students": student_emails
            },
            nid=nid,
            nid_key="id"
        )
        return self._handle_error(r, "Could not add users.")