docs: def enable_sharding(arctic, library_name, hashed=True, key='symbol'):
      """
      Enable sharding on a library
  
      Parameters:
      -----------
      arctic: `arctic.Arctic` Arctic class
  
      library_name: `basestring` library name
  
      hashed: `bool` if True, use hashed sharding, if False, use range sharding
              See https://docs.mongodb.com/manual/core/hashed-sharding/,
              as well as https://docs.mongodb.com/manual/core/ranged-sharding/ for details.
  
      key: `basestring` key to be used for sharding. Defaults to 'symbol', applicable to
           all of Arctic's built-in stores except for BSONStore, which typically uses '_id'.
           See https://docs.mongodb.com/manual/core/sharding-shard-key/ for details.
      """
      c = arctic._conn
      lib = arctic[library_name]._arctic_lib
      dbname = lib._db.name
      library_name = lib.get_top_level_collection().name
      try:
          c.admin.command('enablesharding', dbname)
      except pymongo.errors.OperationFailure as e:
          if 'already enabled' not in str(e):
              raise
      if not hashed:
          logger.info("Range sharding '" + key + "' on: " + dbname + '.' + library_name)
          c.admin.command('shardCollection', dbname + '.' + library_name, key={key: 1})
      else:
          logger.info("Hash sharding '" + key + "' on: " + dbname + '.' + library_name)
          c.admin.command('shardCollection', dbname + '.' + library_name, key={key: 'hashed'})