<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 3. Structure standardization
(c) 2019, 2020 Dr. Ramil Nugmanov;
(c) 2019 Dr. Timur Madzhidov; Ravil Mukhametgaleev
Installation instructions of CGRtools package information and tutorial's files see on https
Step1:  3.1. Molecules
MoleculeContainer has standardize, kekule, thiele, neutralize, implicify_hydrogens and canonicalize methods.
Method thiele transforms Kekule representation of rings into aromatized.
Method standardize applies functional group standardization rules to molecules (more than 50 rules).
Method canonicalize apply set of methods
Step2:  Molecules has explicify_hydrogens and implicify_hydrogens methods to handle hydrogens.
This methods is used to add or remove hydrogens in molecule.
Note implicify_hydrogens working for aromatic rings only in kekule form. explicify_hydrogens for aromatized forms required kekule and optionally thiele procedures applyed before.
Step3:  3.2. Reactions standardization
ReactionContainer has same methods as molecules. In this case they are applied to all molecules in reaction.
<ASSISTANT_TASK:>
Python Code:
import pkg_resources
if pkg_resources.get_distribution('CGRtools').version.split('.')[:2] != ['4', '0']:
    print('WARNING. Tutorial was tested on 4.0 version of CGRtools')
else:
    print('Welcome!')
# load data for tutorial
from pickle import load
from traceback import format_exc
with open('molecules.dat', 'rb') as f:
    molecules = load(f) # list of MoleculeContainer objects
with open('reactions.dat', 'rb') as f:
    reactions = load(f) # list of ReactionContainer objects
m1, m2, m3, m4 = molecules # molecule
r2 = reactions[2] # reaction
Explanation: 3. Structure standardization
(c) 2019, 2020 Dr. Ramil Nugmanov;
(c) 2019 Dr. Timur Madzhidov; Ravil Mukhametgaleev
Installation instructions of CGRtools package information and tutorial's files see on https://github.com/stsouko/CGRtools
NOTE: Tutorial should be performed sequentially from the start. Random cell running will lead to unexpected results.
End of explanation
m3 # molecule with kekulized ring
m3.standardize()  # apply standardization. Returns True if any group found
m3 # group-standardized structure.
m3.thiele() # aromatizes and returns True then any ring found
m3
Explanation: 3.1. Molecules
MoleculeContainer has standardize, kekule, thiele, neutralize, implicify_hydrogens and canonicalize methods.
Method thiele transforms Kekule representation of rings into aromatized.
Method standardize applies functional group standardization rules to molecules (more than 50 rules).
Method canonicalize apply set of methods: neutralize, standardize, kekule, implicify_hydrogens, thiele
End of explanation
m3.explicify_hydrogens() # return number of added hydrogens
m3.clean2d(randomize=True) # for added hydrogen atoms coordinates are not calculated. Thus, it looks like hydrogen has the same position on image
m3
m3.kekule()
m3.implicify_hydrogens()
m3
Explanation: Molecules has explicify_hydrogens and implicify_hydrogens methods to handle hydrogens.
This methods is used to add or remove hydrogens in molecule.
Note implicify_hydrogens working for aromatic rings only in kekule form. explicify_hydrogens for aromatized forms required kekule and optionally thiele procedures applyed before.
End of explanation
r2
r2.standardize()
r2.explicify_hydrogens()
r2.clean2d(randomize=True)
r2
Explanation: 3.2. Reactions standardization
ReactionContainer has same methods as molecules. In this case they are applied to all molecules in reaction.
End of explanation
<END_TASK>