<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_sid(sid):
 """Return None if not found."""

    try:
        return d1_gmn.app.models.Chain.objects.get(sid__did=sid)
    except d1_gmn.app.models.Chain.DoesNotExist:
        pass