<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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