Get or Set module weight - Drupal 8

In Drupal 8, module's weight is stored into ConfigFactory. Here's how to get or set module weight.

Get module weight: