<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_url(self, resource, params=None):
 """ Generate url for request """


        # replace placeholders

        pattern = r'\{(.+?)\}'

        resource = re.sub(pattern, lambda t: str(params.get(t.group(1), '')), resource)

        # build url

        parts = (self.endpoint, '/api/', resource)
        return '/'.join(map(lambda x: str(x).strip('/'), parts))