def _get_hydrated_path(field):
    """Return HydratedPath object for file-type field."""
    if isinstance(field, str) and hasattr(field, 'file_name'):
        return field
    if isinstance(field, dict) and 'file' in field:
        hydrated_path = field['file']
    if not hasattr(hydrated_path, 'file_name'):
        raise TypeError('Filter argument must be a valid file-type field.')
    return hydrated_path
