def lock(path=None):
    """
    Encrypts a given path. This directory can be used to store secrets needed for normal
    Lemur operation. This is especially useful for storing secrets needed for communication
    with third parties (e.g. external certificate authorities).

    Lemur does not assume anything about the contents of the directory and will attempt to
    encrypt all files contained within. Currently this has only been tested against plain
    text files.

    Path defaults ~/.lemur/keys

    :param: path
    """
    if not path:
        path = os.path.expanduser("~/.lemur/keys")

    dest_dir = os.path.join(path, "encrypted")
    click.echo("[!] Generating a new key...")

    key = Fernet.generate_key()

    if not os.path.exists(dest_dir):
        click.echo(f"[+] Creating encryption directory: {dest_dir}")
        os.makedirs(dest_dir)

    for root, dirs, files in os.walk(os.path.join(path, "decrypted")):
        for f in files:
            source = os.path.join(root, f)
            dest = os.path.join(dest_dir, f + ".enc")
            with open(source, "rb") as in_file, open(dest, "wb") as out_file:
                f = Fernet(key)
                data = f.encrypt(in_file.read())
                out_file.write(data)
                click.echo(
                    f"[+] Writing file: {dest} Source: {source}"
                )

    click.echo(f"[+] Keys have been encrypted with key {key}")

    Encrypts a given path. This directory can be used to store secrets needed for normal
    Lemur operation. This is especially useful for storing secrets needed for communication
    with third parties (e.g. external certificate authorities).

    Lemur does not assume anything about the contents of the directory and will attempt to
    encrypt all files contained within. Currently this has only been tested against plain
    text files.

    Path defaults ~/.lemur/keys

    :param: path
    
lemur/manage.py