code: def _replace_pg_hba(self):
          
  
          # when we are doing custom bootstrap we assume that we don't know superuser password
          # and in order to be able to change it, we are opening trust access from a certain address
          if self._running_custom_bootstrap:
              addresses = {'': 'local'}
              if 'host' in self._local_address and not self._local_address['host'].startswith('/'):
                  for _, _, _, _, sa in socket.getaddrinfo(self._local_address['host'], self._local_address['port'],
                                                           0, socket.SOCK_STREAM, socket.IPPROTO_TCP):
                      addresses[sa[0] + '/32'] = 'host'
  
              with open(self._pg_hba_conf, 'w') as f:
                  f.write(self._CONFIG_WARNING_HEADER)
                  for address, t in addresses.items():
                      f.write((
                          '{0}\treplication\t{1}\t{3}\ttrust\n'
                          '{0}\tall\t{2}\t{3}\ttrust\n'
                      ).format(t, self._replication['username'], self._superuser.get('username') or 'all', address))
          elif not self._server_parameters.get('hba_file') and self.config.get('pg_hba'):
              with open(self._pg_hba_conf, 'w') as f:
                  f.write(self._CONFIG_WARNING_HEADER)
                  for line in self.config['pg_hba']:
                      f.write('{0}\n'.format(line))
              return True
docs: Replace pg_hba.conf content in the PGDATA if hba_file is not defined in the
          `postgresql.parameters` and pg_hba is defined in `postgresql` configuration section.
  
          :returns: True if pg_hba.conf was rewritten.