def generate_policy(principal_id, effect, method_arn):
    """
    Utility function to generate a policy document

    Args:
        principal_id (str): request's user
        effect (str): Allow or Deny
        method_arn (str): resource's ARN

    Returns: dict
    """

    if not effect or not method_arn:

        return None

    response = {
        "principalId": principal_id,
        "policyDocument": {
            "Version": "2012-10-17",
            "Statement": [{
                "Action": "execute-api:Invoke",
                "Effect": effect,
                "Resource": method_arn
            }]
        }
    }

    return response