def get_fk_from_field(m, f_name, f_value):
    """Read an object to be used as foreign key in another record.
    It return a formatted message if it finds an error
    """
    msg = ""
    try:
        obj = m.objects.get(**{f_name: f_value})

    except m.DoesNotExist:
        msg = f'{f_name} "{f_value}"'
        obj = None
    except ValueError:
        msg = f'{f_name} "{f_value}": wrong type. \n'
        obj = None
    return obj, msg