def get_user_privileges(connection, id, project_id=None, privilege_level=None):
    """Get user's privileges of a project including the source of the
    privileges.

    Args:
        connection (object): MicroStrategy connection object returned by
            `connection.Connection()`.
        id (str): User ID
        project_id (string, optional): Project ID
        privilege_level (string, optional): Project Level Privilege

    Returns:
        HTTP response object returned by the MicroStrategy REST server.
    """
    url = f'{connection.base_url}/api/users/{id}/privileges/'
    return connection.session.get(
        url=url,
        params={
            'privilege.level': privilege_level,
            'projectId': project_id
        },
    )