import requests


def _get_federation_info(address_or_id, federation_service, fed_type='name'):
    """Send a federation query to a Stellar Federation service.

    Note: The preferred method of making this call is via
    :function:`federation`, as it handles error checking and parsing of
    arguments.

    :param str address_or_id: The address which you expect te retrieve
        federation information about.
    :param str federation_service: The url of the federation service you're
        requesting information from.
    :param str fed_type: The type of federation query that you are making. Must
        be 'name', 'id', 'forward', or 'txid'.
    :return dict: The federation query response decoded from JSON as a dict.

    """
    params = {'q': address_or_id, 'type': fed_type}
    r = requests.get(federation_service, params=params)
    if r.status_code == 200:
        return r.json()
    else:
        return None