def __virtual__(algorithm='sha512'):
    # The hashlib function on Python <= 2.6 does not provide the attribute 'algorithms'
    # This attribute was introduced on Python >= 2.7
    if not hasattr(hashlib, 'algorithms') and not hasattr(hashlib, algorithm):
        return (False, 'The random execution module cannot be loaded: only available in Python >= 2.7.')

    return __virtualname__
Sanity check for compatibility with Python 2.6 / 2.7
dataset/ETHPy150Open saltstack/salt/salt/modules/mod_random.py/__virtual__