code: def get_basebackup(self, arg):
          
          if not arg.tablespace_dir:
              tablespace_mapping = {}
          else:
              try:
                  tablespace_mapping = dict(v.split("=", 1) for v in arg.tablespace_dir)
              except ValueError:
                  raise RestoreError("Invalid tablespace mapping {!r}".format(arg.tablespace_dir))
  
          self.config = config.read_json_config_file(arg.config, check_commands=False, check_pgdata=False)
          site = config.get_site_from_config(self.config, arg.site)
          try:
              self.storage = self._get_object_storage(site, arg.target_dir)
              self._get_basebackup(
                  pgdata=arg.target_dir,
                  basebackup=arg.basebackup,
                  site=site,
                  debug=arg.debug,
                  status_output_file=arg.status_output_file,
                  primary_conninfo=arg.primary_conninfo,
                  recovery_end_command=arg.recovery_end_command,
                  recovery_target_action=arg.recovery_target_action,
                  recovery_target_name=arg.recovery_target_name,
                  recovery_target_time=arg.recovery_target_time,
                  recovery_target_xid=arg.recovery_target_xid,
                  restore_to_master=arg.restore_to_master,
                  overwrite=arg.overwrite,
                  tablespace_mapping=tablespace_mapping,
                  tablespace_base_dir=arg.tablespace_base_dir,
              )
          except RestoreError:  # pylint: disable=try-except-raise
              # Pass RestoreErrors thru
              raise
          except Exception as ex:
              if self.log_tracebacks:
                  self.log.exception("Unexpected _get_basebackup failure")
              raise RestoreError("{}: {}".format(ex.__class__.__name__, ex))
docs: Download a basebackup from an object store