import time
import random


def _custom_libname(filetype, salt_len=2):
    """
    Choose a custom name for library file
        Format:
            filetype: file extensiion
            cur_time: current time
            salt: salt_len number of digits
            <cur_time>_<salt>.<filetype>

    Args:
        filetype: The extension the library filename will be saved as
        salt_len: The length of the salt
            salt is a sequence of random digit
            default to 2

    Returns:
        Library file name string
    """
    filetype = filetype or 'lib'
    cur_time = time.time_ns()
    salt = ''.join(str(d) for d in random.sample(range(10), salt_len))
    return "%d_%s.%s" % (cur_time, salt, filetype)