# Copyright 1999-2016. Parallels IP Holdings GmbH. All Rights Reserved.
import sys
import string

MAILMAN_PATH = sys.argv[1]
sys.path.append(MAILMAN_PATH)

from Mailman import MailList
from Mailman import Errors


def main():
    listname = sys.argv[2]
    listname = string.lower(listname)
    try:
        mlist = MailList.MailList(listname, lock=0)
        print(mlist.password)
    except Errors.MMListError as e:
        print(listname + ' is not found')
        sys.exit(1)


if __name__ == '__main__':
    main()
