def gene2bin(parameters, gene, geneType):
    """
    geneBin = gene2bin(parameters, gene, geneType)

    Turns genes into the binary-string form

    gene:
        integer
    geneType:
        string
    geneBin:
        string, of all ones and zeros

    >>> geneType = 'repn'
    >>> parameters = {'genetics': {geneType: {'noLoci': 20} } }
    >>> gg = gene2bin(parameters, 0, geneType)
    >>> len(gg) # see it's the same length as the number of loci
    20
    >>> gg # and it is the number 0 in binary of length 20
    '00000000000000000000'
    >>> gene2bin(parameters, 50,geneType) # another example
    '00000000000000110010'
    """

    return format(gene, '0' + str(parameters['genetics'][geneType]['noLoci']) + 'b')