def encrypt(passwd):
    """
    Encrypts the incoming password after adding some salt to store
    it in the database.

    @param passwd: password portion of user credentials
    @type passwd: string

    @returns: encrypted/salted string
    """
    m = sha1()
    salt = hexlify(os.urandom(salt_len))
    m.update(unicode2bytes(passwd) + salt)
    crypted = bytes2unicode(salt) + m.hexdigest()
    return crypted
Encrypts the incoming password after adding some salt to store
    it in the database.

    @param passwd: password portion of user credentials
    @type passwd: string

    @returns: encrypted/salted string