'Randomly generate a fresh, new DSA key.
:Parameters:
bits : int
Key length, or size (in bits) of the DSA modulus
*p*.
It must be a multiple of 64, in the closed
interval [512,1024].
randfunc : callable
Random number generation function; it should accept
a single integer N and return a string of random data
N bytes long.
If not specified, a new one will be instantiated
from ``Crypto.Random``.
progress_func : callable
Optional function that will be called with a short string
containing the key parameter currently being generated;
it\'s useful for interactive applications where a user is
waiting for a key to be generated.
:attention: You should always use a cryptographically secure random number generator,
such as the one defined in the ``Crypto.Random`` module; **don\'t** just use the
current time and the ``random`` module.
:Return: A DSA key object (`_DSAobj`).
:Raise ValueError:
When **bits** is too little, too big, or not a multiple of 64.'

def generate(self, bits, randfunc=None, progress_func=None):

    for i in (0, 1, 2, 3, 4, 5, 6, 7, 8):
        if (bits == (512 + (64 * i))):
            return self._generate(bits, randfunc, progress_func)
    raise ValueError(('Number    of    bits    in    p    must    be    a    multiple    of    64    between    512    and    1024,    not    %d    bits' % (bits,)))
