code: def to_commit(obj):
      
      if obj.type == 'tag':
          obj = deref_tag(obj)
  
      if obj.type != "commit":
          raise ValueError("Cannot convert object %r to type commit" % obj)
      # END verify type
      return obj
docs: Convert the given object to a commit if possible and return it