public static function guessExtensionFromType(string $type, ?string $proposed_extension = null)
	{
		$type = trim(strtolower($type), '. ');

		$proposed_extension = trim(strtolower($proposed_extension));

		if (! is_null($proposed_extension) && array_key_exists($proposed_extension, static::$mimes) && in_array($type, is_string(static::$mimes[$proposed_extension]) ? [static::$mimes[$proposed_extension]] : static::$mimes[$proposed_extension]))
		{
			return $proposed_extension;
		}

		foreach (static::$mimes as $ext => $types)
		{
			if (is_string($types) && $types === $type)
			{
				return $ext;
			}
			else if (is_array($types) && in_array($type, $types))
			{
				return $ext;
			}
		}

		return null;
	}