def gradient_compression_params(args: argparse.Namespace) -> Optional[Dict[str, Any]]:
    """
    :param args: Arguments as returned by argparse.
    :return: Gradient compression parameters or None.
    """
    if args.gradient_compression_type is None:
        return None
    else:
        return {'type': args.gradient_compression_type, 'threshold': args.gradient_compression_threshold}