<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def id_by_index(index, resources):
 """Helper method to fetch the id or address of a resource by its index Args: resources (list of objects):
 The resources to be paginated index (integer):
 The index of the target resource Returns: str: The address or header_signature of the resource, returns an empty string if not found """

        if index < 0 or index >= len(resources):
            return ''

        try:
            return resources[index].header_signature
        except AttributeError:
            return resources[index].address