<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def process_csr(cls, common_name, csr=None, private_key=None, country=None, state=None, city=None, organisation=None, branch=None):
 """ Create a PK and a CSR if needed."""

        if csr:
            if branch or organisation or city or state or country:
                cls.echo('Following options are only used to generate'
                         ' the CSR.')
        else:
            params = (('CN', common_name),
                      ('OU', branch),
                      ('O', organisation),
                      ('L', city),
                      ('ST', state),
                      ('C', country))
            params = [(key, val) for key, val in params if val]
            csr = cls.create_csr(common_name, private_key, params)

        if csr and os.path.exists(csr):
            with open(csr) as fcsr:
                csr = fcsr.read()

        return csr