Allow passing of Branch objects to Repository.checkout()

Currently the Repository.checkout() method checks to see if the refname
parameter is a Reference object with the following check:

    if type(refname) is Reference:

This does not allow subclasses of Reference (such as Branch) to be used.

This pull request remedies this issue by changing the check to use
instanceof(), like so:

    if instanceof(refname, Reference):

This pull request also adds a new test for this functionality.