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

def buildprior(self, prior, mopt=None, extend=False):
        " Extract the model's parameters from prior. "
        newprior = {}
        # allow for log-normal, etc priors
        intercept, slope = gv.get_dictkeys(
            prior, [self.intercept, self.slope]
            )
        newprior[intercept] = prior[intercept]
        if mopt is None:
            # slope parameter marginalized if mopt is not None
            newprior[slope] = prior[slope]
        return newprior