<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_client(project_id=None, credentials=None, service_url=None, service_account=None, private_key=None, private_key_file=None, json_key=None, json_key_file=None, readonly=True, swallow_results=True, num_retries=0):
 """Return a singleton instance of BigQueryClient. Either AssertionCredentials or a service account and private key combination need to be provided in order to authenticate requests to BigQuery. Parameters project_id : str, optional The BigQuery project id, required unless json_key or json_key_file is provided. credentials : oauth2client.client.SignedJwtAssertionCredentials, optional AssertionCredentials instance to authenticate requests to BigQuery (optional, must provide `service_account` and (`private_key` or `private_key_file`) or (`json_key` or `json_key_file`) if not included service_url : str, optional A URI string template pointing to the location of Google's API discovery service. Requires two parameters {api} and {apiVersion} that when filled in produce an absolute URI to the discovery document for that service. If not set then the default googleapiclient discovery URI is used. See `credentials` service_account : str, optional The Google API service account name. See `credentials` private_key : str, optional The private key associated with the service account in PKCS12 or PEM format. See `credentials` private_key_file : str, optional The name of the file containing the private key associated with the service account in PKCS12 or PEM format. See `credentials` json_key : dict, optional The JSON key associated with the service account. See `credentials` json_key_file : str, optional The name of the JSON key file associated with the service account. See `credentials`. readonly : bool Bool indicating if BigQuery access is read-only. Has no effect if credentials are provided. Default True. swallow_results : bool If set to False, then return the actual response value instead of converting to boolean. Default True. num_retries : int, optional The number of times to retry the request. Default 0 (no retry). Returns ------- BigQueryClient An instance of the BigQuery client. """


    if not credentials:
        assert (service_account and (private_key or private_key_file)) or (
            json_key or json_key_file), \
            'Must provide AssertionCredentials or service account and P12 key\
            or JSON key'

    if not project_id:
        assert json_key or json_key_file, \
            'Must provide project_id unless json_key or json_key_file is\
            provided'

    if service_url is None:
        service_url = DISCOVERY_URI

    scope = BIGQUERY_SCOPE_READ_ONLY if readonly else BIGQUERY_SCOPE

    if private_key_file:
        credentials = _credentials().from_p12_keyfile(service_account,
                                                      private_key_file,
                                                      scopes=scope)

    if private_key:
        try:
            if isinstance(private_key, basestring):
                private_key = private_key.decode('utf-8')
        except NameError:
            # python3 -- private_key is already unicode
            pass
        credentials = _credentials().from_p12_keyfile_buffer(
            service_account,
            StringIO(private_key),
            scopes=scope)

    if json_key_file:
        with open(json_key_file, 'r') as key_file:
            json_key = json.load(key_file)

    if json_key:
        credentials = _credentials().from_json_keyfile_dict(json_key,
                                                            scopes=scope)
        if not project_id:
            project_id = json_key['project_id']

    bq_service = _get_bq_service(credentials=credentials,
                                 service_url=service_url)

    return BigQueryClient(bq_service, project_id, swallow_results,
                          num_retries)