<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_student_certificates(self, username, course_ids=None):
 """ Returns an Certificates object with the user certificates Args: username (str):
 an edx user's username course_ids (list):
 a list of edX course ids. Returns: Certificates: object representing the student certificates for a course """

        # if no course ids are provided, let's get the user enrollments
        if course_ids is None:
            enrollments_client = CourseEnrollments(self.requester, self.base_url)
            enrollments = enrollments_client.get_student_enrollments()
            course_ids = list(enrollments.get_enrolled_course_ids())

        all_certificates = []
        for course_id in course_ids:
            try:
                all_certificates.append(self.get_student_certificate(username, course_id))
            except HTTPError as error:
                if error.response.status_code >= 500:
                    raise

        return Certificates(all_certificates)