def add_contributor_json(user, current_user=None):
    # get shared projects
    if current_user:
        n_projects_in_common = current_user.n_projects_in_common(user)
    else:
        n_projects_in_common = 0

    current_employment = None
    education = None

    if user.jobs:
        current_employment = user.jobs[0]['institution']

    if user.schools:
        education = user.schools[0]['institution']

    return {
        'fullname': user.fullname,
        'email': user.username,
        'id': user._primary_key,
        'employment': current_employment,
        'education': education,
        'n_projects_in_common': n_projects_in_common,
        'registered': user.is_registered,
        'active': user.is_active,
        'gravatar_url': gravatar(
            user, use_ssl=True,
            size=settings.PROFILE_IMAGE_MEDIUM
        ),
        'profile_url': user.profile_url
    }
TODO: add docstring
dataset/ETHPy150Open CenterForOpenScience/osf.io/website/profile/utils.py/add_contributor_json--crossover with--dataset/ETHPy150Open treasure-data/td-client-python/tdclient/job_api.py/JobAPI.job_result_each