def METHOD_NAME(crypt_salt=None, password=None, algorithm=None):
    """
    Generate /etc/shadow hash using the native crypt module
    """
    if crypt_salt is None:
        # setting crypt_salt to the algorithm makes crypt generate
        #  a salt compatible with the specified algorithm.
        crypt_salt = methods[algorithm]
    else:
        if algorithm != "crypt":
            # all non-crypt algorithms are specified as part of the salt
            crypt_salt = "${}${}".format(methods[algorithm].ident, crypt_salt)
    try:
        ret = crypt.crypt(password, crypt_salt)
    except OSError:
        ret = None
    return ret