code: def test_api_query_format_escape_spaces(api):
      query = SentinelAPI.format_query(
          ingestiondate=("NOW-1DAY", "NOW")
      )
      assert query == 'ingestiondate:["NOW-1DAY" TO "NOW"]'
      assert api.count(ingestiondate=("NOW-1DAY", "NOW")) > 0
  
      query = SentinelAPI.format_query(ingestiondate=("NOW-1DAY", None))
      assert query == 'ingestiondate:["NOW-1DAY" TO *]'
      assert api.count(ingestiondate=("NOW-1DAY", None)) > 0
  
      query = SentinelAPI.format_query(
          ingestiondate="[NOW-1DAY TO NOW]"
      )
      assert query == "ingestiondate:[NOW-1DAY TO NOW]"
  
      query = SentinelAPI.format_query(
          ingestiondate=" [NOW-1DAY TO NOW] "
      )
      assert query == "ingestiondate:[NOW-1DAY TO NOW]"
  
      query = SentinelAPI.format_query(
          relativeorbitnumber="{101 TO 103}"
      )
      assert query == "relativeorbitnumber:{101 TO 103}"
      assert api.count(relativeorbitnumber="{101 TO 103}") > 0
  
      query = SentinelAPI.format_query(filename="S3A_OL_2* ")
      assert query == "filename:S3A_OL_2*"
  
      query = SentinelAPI.format_query(filename="S3A_OL_2?2")
      assert query == "filename:S3A_OL_2?2"
  
      query = SentinelAPI.format_query(timeliness="Non Time Critical")
      assert query == r'timeliness:"Non Time Critical"'
  
      query = SentinelAPI.format_query(timeliness='"Non Time Critical"')
      assert query == r'timeliness:"Non Time Critical"'
  
      query = SentinelAPI.format_query(timeliness="Non\tTime\tCritical")
      assert query == r'timeliness:"Non Time Critical"'
  
      assert api.count(timeliness="Near Real Time") > 0
  
      # Allow for regex weirdness
      query = SentinelAPI.format_query(timeliness=".+ Critical")
      assert query == r'timeliness:".+ Critical"'
      assert api.count(timeliness=".+ Critical") > 0
  
      query = SentinelAPI.format_query(identifier="/S[123 ]A.*/")
      assert query == "identifier:/S[123 ]A.*/"
      kwargs = dict(
          beginposition=("20180101", "20180130"),
          area="POINT(14.20 59.96)",
      )
      regex_count = api.count(identifier="/S[12 ]A.*/", **kwargs)
      c1 = api.count(identifier="S1A*", **kwargs)
      c2 = api.count(identifier="S2A*", **kwargs)
      assert min(regex_count, c1, c2) > 0
      assert regex_count == c1 + c2
  
imports: from contextlib import contextmanager
  from datetime import datetime, date, timedelta
  import pytest
  import requests_mock
  from requests.exceptions import StreamConsumedError, ContentDecodingError, InvalidProxyURL, InvalidHeader, TooManyRedirects, ReadTimeout, SSLError
  from sentinelsat import format_query_date, SentinelAPI
  from sentinelsat.exceptions import QuerySyntaxError, QueryLengthError, UnauthorizedError
  from sentinelsat.sentinel import _format_order_by
label_desc: Use image node_id 10 for calling a global function with example usage: test_api_query_format_escape_spaces(api) without return types