docs: def metadata_to_dict(metadata):
      """ Looks at metadata.xml file of sentinel product and extract useful keys
      Returns a python dict """
  
      tree = etree.parse(metadata)
      root = tree.getroot()
  
      meta = OrderedDict()
  
      keys = [
          'SPACECRAFT_NAME',
          'PRODUCT_STOP_TIME',
          'Cloud_Coverage_Assessment',
          'PROCESSING_LEVEL',
          'PRODUCT_TYPE',
          'PROCESSING_BASELINE',
          'SENSING_ORBIT_NUMBER',
          'SENSING_ORBIT_DIRECTION',
          'PRODUCT_FORMAT',
      ]
  
      # grab important keys from the file
      for key in keys:
          try:
              meta[key.lower()] = root.findall('.//' + key)[0].text
          except IndexError:
              meta[key.lower()] = None
  
      meta['product_cloud_coverage_assessment'] = float(meta.pop('cloud_coverage_assessment'))
  
      meta['sensing_orbit_number'] = int(meta['sensing_orbit_number'])
  
      # get tile list
      meta['tiles'] = get_tiles_list(root.findall('.//Product_Organisation')[0])
  
      # get available bands
      if root.findall('.//Band_List'):
          bands = root.findall('.//Band_List')[0]
          meta['band_list'] = []
          for b in bands:
              band = b.text.replace('B', '')
              if len(band) == 1:
                  band = 'B' + pad(band, 2)
              else:
                  band = b.text
              meta['band_list'].append(band)
      else:
          bands = root.findall('.//Spectral_Information_List')[0]
          meta['band_list'] = []
          for b in bands:
              band = b.attrib['physicalBand'].replace('B', '')
              if len(band) == 1:
                  band = 'B' + pad(band, 2)
              else:
                  band = b.attrib['physicalBand']
              meta['band_list'].append(band)
  
      return meta