def expand_resources(resources):
    """
    Construct the submit_job arguments from the resource dict.
    
    In general, a k,v from the dict turns into an argument '--k v'.
    If the value is a boolean, then the argument turns into a flag.
    If the value is a list/tuple, then multiple '--k v' are presented,
    one for each list item.

    :resources: a dict of arguments for the farm submission command.
    """
    cmd = ''
    for field, val in resources.items():
        if type(val) is bool:
            if val is True:
                cmd += '--{} '.format(field)
        elif type(val) is list or type(val) is tuple:
            for mp in val:
                cmd += '--{} {} '.format(field, mp)
        else:
            cmd += '--{} {} '.format(field, val)
    return cmd