def format(o, keys=None, full=False):
    """ format an object into a displayable string. """
    if keys is None:
        keys = vars(o).keys()
    res = []
    txt = ''
    for k in keys:
        v = getattr(o, k, None)
        if not v:
            continue
        v = str(v)
        if full:
            res.append('%s=%s ' % (k, v))
        else:
            res.append(v)
    for v in res:
        txt += '%s ' % v.strip()
    return txt.strip()
