<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def add_hypermedia(self, obj):
        '''
        Adds HATEOAS links to the resource. Adds href link to self.
        Override in subclasses to include additional functionality
        '''
        if hasattr(self, 'pk'):
            obj['_links'] = {
                'self': {
                    'href': '{}{}/'.format(self.get_resource_uri(), obj[self.pk])
                }
            }