def is_enrolled(course, *, roles=None):
    'Check whether the current user is enrolled as any of the ``roles`` for\n    ``course``.\n\n    :param course: the course code to check\n    :type course: str\n\n    :param roles: the roles to check for the user\n    :type roles: list-like\n\n    :return: ``True`` if the user is any of ``roles``, ``False`` otherwise\n    '
    try:
        endpoint = get_endpoint(course=course)
        for participation in get_user()['participations']:
            if (roles and (participation['role'] not in roles)):
                continue
            if (participation['course']['offering'] != endpoint):
                continue
            return True
        return False
    except Exception as e:
        print(e)
        return False
Check whether the current user is enrolled as any of the ``roles`` for
``course``.

:param course: the course code to check
:type course: str

:param roles: the roles to check for the user
:type roles: list-like

:return: ``True`` if the user is any of ``roles``, ``False`` otherwise
def is_enrolled(course, *, roles=None):
    'Check whether the current user is enrolled as any of the ``roles`` for\n    ``course``.\n\n    :param course: the course code to check\n    :type course: str\n\n    :param roles: the roles to check for the user\n    :type roles: list-like\n\n    :return: ``True`` if the user is any of ``roles``, ``False`` otherwise\n    '
    try:
        endpoint = get_endpoint(course=course)
        for participation in get_user()['participations']:
            if (roles and (participation['role'] not in roles)):
                continue
            if (participation['course']['offering'] != endpoint):
                continue
            return True
        return False
    except Exception as e:
        print(e)
        return False