<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _get_entity_prop(self, entity, prop):
 """ returns Wikidata entity property value """

        variant = self.params.get('variant')
        lang = self.params.get('lang')

        if entity.get(prop):
            ent = entity[prop]
            try:
                return ent[variant or lang].get('value')
            except AttributeError:
                return ent.get('value')