def decrypt(ciphertext, rails):
    """
    Rail fence cipher. Decrypts plaintext by given number of rails.

    :param ciphertext: encrypted plaintext.
    :param rails: number of rails being used to encrypt the plaintext.
    :returns: decrypted text (plaintext).

    See https://en.wikipedia.org/wiki/Rail_fence_cipher
    Example:

    >>> decrypt("DNEOS AGRU", 2)
    'DANGEROUS'
    >>> decrypt("DGO AEU NRS", 3)
    'DANGEROUS'
    """
    xrails = len(ciphertext) // rails + 1
    data = [""] * xrails
    for index, character in enumerate(ciphertext):
        data[index % xrails] += character

    return "".join(data[0:-1])