<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_chain_by_pid(pid):
 """Find chain by pid. Return None if not found. """

    try:
        return d1_gmn.app.models.ChainMember.objects.get(pid__did=pid).chain
    except d1_gmn.app.models.ChainMember.DoesNotExist:
        pass