def switch_org(orgname, profile='grafana'):
    '''
    Switch the current organization.

    name
        Name of the organization to switch to.

    profile
        Configuration profile used to connect to the Grafana instance.
        Default is 'grafana'.

    CLI Example:

    .. code-block:: bash

        salt '*' grafana4.switch_org <name>
    '''
    if isinstance(profile, string_types):
        profile = __salt__['config.option'](profile)
    org = get_org(orgname, profile)
    response = requests.post(
        '{0}/api/user/using/{1}'.format(profile['grafana_url'], org['id']),
        auth=_get_auth(profile),
        headers=_get_headers(profile),
        timeout=profile.get('grafana_timeout', 3),
    )
    if response.status_code >= 400:
        response.raise_for_status()
    return org