docs: def licenses(source=DEFAULT_LICENSE_FILE):
      '''Feed the licenses from a JSON file'''
      if source.startswith('http'):
          json_licenses = requests.get(source).json()
      else:
          with open(source) as fp:
              json_licenses = json.load(fp)
  
      if len(json_licenses):
          log.info('Dropping existing licenses')
          License.drop_collection()
  
      for json_license in json_licenses:
          flags = []
          for field, flag in FLAGS_MAP.items():
              if json_license.get(field, False):
                  flags.append(flag)
  
          license = License.objects.create(
              id=json_license['id'],
              title=json_license['title'],
              url=json_license['url'] or None,
              maintainer=json_license['maintainer'] or None,
              flags=flags,
              active=json_license.get('active', False),
              alternate_urls=json_license.get('alternate_urls', []),
              alternate_titles=json_license.get('alternate_titles', []),
          )
          log.info('Added license "%s"', license.title)
      try:
          License.objects.get(id=DEFAULT_LICENSE['id'])
      except License.DoesNotExist:
          License.objects.create(**DEFAULT_LICENSE)
          log.info('Added license "%s"', DEFAULT_LICENSE['title'])
      success('Done')