def get_reference_key(entity, prop_name):
    """Returns a encoded key from a ``db.ReferenceProperty`` without fetching
    the referenced entity. Example::

        from google.appengine.ext import db
        from tipfy.appengine.db import get_reference_key

        # Set a book entity with an author reference.
        class Author(db.Model):
            name = db.StringProperty()

        class Book(db.Model):
            title = db.StringProperty()
            author = db.ReferenceProperty(Author)

        author = Author(name='Stephen King')
        author.put()

        book = Book(key_name='the-shining', title='The Shining', author=author)
        book.put()

        # Now let's fetch the book and get the author key without fetching it.
        fetched_book = Book.get_by_key_name('the-shining')
        assert str(author.key()) == str(get_reference_key(fetched_book,
            'author'))

    :param entity:
        A ``db.Model`` instance.
    :param prop_name:
        The name of the ``db.ReferenceProperty`` property.
    :returns:
        An entity Key, as a string.
    """
    return getattr(entity.__class__, prop_name).get_value_for_datastore(entity)