Make sure we get a record instance even if we pass an xmlid.

def safe_record(ctx, item):
    """Make sure we get a record instance even if we pass an xmlid."""
    if isinstance(item, basestring):
        return ctx.env.ref(item)
    return item