docs: def get_num_bioassemblies(pdb_id, cache=False, outdir=None, force_rerun=False):
      """Check if there are bioassemblies using the PDB REST API, and if there are, get the number of bioassemblies
      available.
  
      See: https://www.rcsb.org/pages/webservices/rest, section 'List biological assemblies'
  
      Not all PDB entries have biological assemblies available and some have multiple. Details that are necessary to
      recreate a biological assembly from the asymmetric unit can be accessed from the following requests.
  
      - Number of biological assemblies associated with a PDB entry
      - Access the transformation information needed to generate a biological assembly (nr=0 will return information
        for the asymmetric unit, nr=1 will return information for the first assembly, etc.)
  
      A query of https://www.rcsb.org/pdb/rest/bioassembly/nrbioassemblies?structureId=1hv4 returns this::
  
          <nrBioAssemblies structureId="1HV4" hasAssemblies="true" count="2"/>
  
      Args:
          pdb_id (str): PDB ID
          cache (bool): If the XML file should be downloaded
          outdir (str): If cache, then specify the output directory
          force_rerun (bool): If cache, and if file exists, specify if API should be queried again
  
      """
      parser = etree.XMLParser(ns_clean=True)
  
      if not outdir:
          outdir = os.getcwd()
      outfile = op.join(outdir, '{}_nrbiomols.xml'.format(pdb_id))
  
      if ssbio.utils.force_rerun(force_rerun, outfile):
          page = 'https://www.rcsb.org/pdb/rest/bioassembly/nrbioassemblies?structureId={}'.format(pdb_id)
          req = requests.get(page)
  
          if req.status_code == 200:
              response = req.text
  
              # Save the XML file
              if cache:
                  with open(outfile, 'w') as f:
                      f.write(response)
  
              # Parse the XML string
              tree = etree.ElementTree(etree.fromstring(response, parser))
              log.debug('Loaded bioassembly information from REST server')
          else:
              log.error('Request timed out')
              req.raise_for_status()
      else:
          tree = etree.parse(outfile, parser)
          log.debug('{}: Loaded existing XML results'.format(outfile))
  
      r = tree.getroot()
      has_biomols = r.get('hasAssemblies')
      if has_biomols == 'true':
          has_biomols = True
      else:
          has_biomols = False
  
      if has_biomols:
          num_biomols = r.get('count')
      else:
          num_biomols = 0
  
      num_biomols = int(num_biomols)
      return num_biomols