<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def availableRoles(self):
        '''
        Some instructors only offer private lessons for certain roles, so we should only allow booking
        for the roles that have been selected for the instructor.
        '''
        if not hasattr(self.instructor,'instructorprivatelessondetails'):
            return []
        return [
            [x.id,x.name] for x in
            self.instructor.instructorprivatelessondetails.roles.all()
        ]