def METHOD_NAME(ids, outfile, prefixed):
    """Writes a dictionary of machine ids to a file
    Each dictionary entry is written on a single line. The function does not
    print trailing new-line if the dictionary contains only one item as it is
    common format of one-liners placed in a dump directory.
    Keyword arguments:
    ids -- a dictionary [generator name: machine ids]
    outfile -- output file
    prefixed -- use 'generator name=' prefix or not
    """
    fmt = '{0}={1}' if prefixed else '{1}'
    if len(ids) > 1:
        fmt += '\n'
    for sd, mid in ids.items():
        outfile.write(fmt.format(sd,mid))