def _collector_url_from_hostport(secure, host, port, use_thrift):
    """
    Create an appropriate collector URL given the parameters.

    `secure` should be a bool.
    """
    if secure:
        protocol = 'https://'
    else:
        protocol = 'http://'
    if use_thrift:
        return ''.join([protocol, host, ':', str(port),
            '/_rpc/v1/reports/binary'])
    else:
        return ''.join([protocol, host, ':', str(port), '/api/v2/reports'])
