import math


def FabricateAllele(motif, length):
    """
    Fabricate an allele with the given motif and length.

    Parameters
    ----------
    motif : str
        the motif to build the allele from
    length : float
        the number of times to copy the motif
        (noninteger implies partial repeats).
        This does NOT specify the desired length of the
        returned string.

    Return
    ------
    str
        the fabricated allele string

    Notes
    -----
    The allele is fabricated with the given motif orientation
    (e.g. motif = 'ACG' could produce 'ACGACGACG' but not 'CGACGACGA').
    Fabricated alleles will contain no impurities nor flanking base pairs.
    In the case of length being a noninteger float (because of partial
    repeats) and where it is unclear if the last nucleotide should be
    included in the fabricated repeat or not due to imprecision in the
    length float, the last nucleotide will always be left off (the
    length of the returned string will always be rounded down).
    """
    fab = math.floor(length) * motif
    idx = 0
    while (len(fab) + 1) / len(motif) < length:
        fab += motif[idx]
        idx += 1

    return fab